Merge pull request #91 from zcash-hackworks/immutable-GetDisplayPrevHash
GetDisplayPrevHash() should not change its argument
This commit is contained in:
commit
50a2667703
|
@ -149,7 +149,7 @@ func main() {
|
||||||
if timeout_count > 0 {
|
if timeout_count > 0 {
|
||||||
timeout_count--
|
timeout_count--
|
||||||
}
|
}
|
||||||
phash = hex.EncodeToString(block.GetPrevHash())
|
phash = hex.EncodeToString(block.GetDisplayPrevHash())
|
||||||
//check for reorgs once we have initial block hash from startup
|
//check for reorgs once we have initial block hash from startup
|
||||||
if hash != phash && reorg_count != -1 {
|
if hash != phash && reorg_count != -1 {
|
||||||
reorg_count++
|
reorg_count++
|
||||||
|
|
|
@ -44,13 +44,14 @@ func (b *Block) GetEncodableHash() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) GetDisplayPrevHash() []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
|
// Reverse byte order
|
||||||
for i := 0; i < len(h)/2; i++ {
|
for i := 0; i < len(rhash)/2; i++ {
|
||||||
j := len(h) - 1 - i
|
j := len(rhash) - 1 - i
|
||||||
h[i], h[j] = h[j], h[i]
|
rhash[i], rhash[j] = rhash[j], rhash[i]
|
||||||
}
|
}
|
||||||
return h
|
return rhash
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) HasSaplingTransactions() bool {
|
func (b *Block) HasSaplingTransactions() bool {
|
||||||
|
|
Loading…
Reference in New Issue