refactor GetDisplayPrevHash(), part of block header
This commit is contained in:
parent
a18cb41c92
commit
7b78663312
|
@ -44,14 +44,7 @@ func (b *Block) GetEncodableHash() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) GetDisplayPrevHash() []byte {
|
func (b *Block) GetDisplayPrevHash() []byte {
|
||||||
rhash := make([]byte, len(b.hdr.HashPrevBlock))
|
return b.hdr.GetDisplayPrevHash()
|
||||||
copy(rhash, b.hdr.HashPrevBlock)
|
|
||||||
// Reverse byte order
|
|
||||||
for i := 0; i < len(rhash)/2; i++ {
|
|
||||||
j := len(rhash) - 1 - i
|
|
||||||
rhash[i], rhash[j] = rhash[j], rhash[i]
|
|
||||||
}
|
|
||||||
return rhash
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) HasSaplingTransactions() bool {
|
func (b *Block) HasSaplingTransactions() bool {
|
||||||
|
|
|
@ -227,3 +227,14 @@ func (hdr *blockHeader) GetEncodableHash() []byte {
|
||||||
|
|
||||||
return digest[:]
|
return digest[:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (hdr *blockHeader) GetDisplayPrevHash() []byte {
|
||||||
|
rhash := make([]byte, len(hdr.HashPrevBlock))
|
||||||
|
copy(rhash, hdr.HashPrevBlock)
|
||||||
|
// Reverse byte order
|
||||||
|
for i := 0; i < len(rhash)/2; i++ {
|
||||||
|
j := len(rhash) - 1 - i
|
||||||
|
rhash[i], rhash[j] = rhash[j], rhash[i]
|
||||||
|
}
|
||||||
|
return rhash
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue