Browse Source
Merge pull request #91 from zcash-hackworks/immutable-GetDisplayPrevHash
GetDisplayPrevHash() should not change its argument
service_pr
Marshall Gaucher
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
6 deletions
-
cmd/ingest/main.go
-
parser/block.go
|
|
@ -149,7 +149,7 @@ func main() { |
|
|
|
if timeout_count > 0 { |
|
|
|
timeout_count-- |
|
|
|
} |
|
|
|
phash = hex.EncodeToString(block.GetPrevHash()) |
|
|
|
phash = hex.EncodeToString(block.GetDisplayPrevHash()) |
|
|
|
//check for reorgs once we have initial block hash from startup
|
|
|
|
if hash != phash && reorg_count != -1 { |
|
|
|
reorg_count++ |
|
|
|
|
|
@ -44,13 +44,14 @@ func (b *Block) GetEncodableHash() []byte { |
|
|
|
} |
|
|
|
|
|
|
|
func (b *Block) GetDisplayPrevHash() []byte { |
|
|
|
h := b.hdr.HashPrevBlock |
|
|
|
rhash := make([]byte, len(b.hdr.HashPrevBlock)) |
|
|
|
copy(rhash, b.hdr.HashPrevBlock) |
|
|
|
// Reverse byte order
|
|
|
|
for i := 0; i < len(h)/2; i++ { |
|
|
|
j := len(h) - 1 - i |
|
|
|
h[i], h[j] = h[j], h[i] |
|
|
|
for i := 0; i < len(rhash)/2; i++ { |
|
|
|
j := len(rhash) - 1 - i |
|
|
|
rhash[i], rhash[j] = rhash[j], rhash[i] |
|
|
|
} |
|
|
|
return h |
|
|
|
return rhash |
|
|
|
} |
|
|
|
|
|
|
|
func (b *Block) HasSaplingTransactions() bool { |
|
|
|