Payload of HashXHistoryValue should be an array of uint32 representing "txnums" #54

Merged
moodyjon merged 2 commits from hashx_history_fix into master 2022-09-06 19:40:06 +02:00
Showing only changes of commit e46ac7c913 - Show all commits

View file

@ -541,7 +541,7 @@ func (v *HashXHistoryValue) PackValue() []byte {
n := len(v.TxNums) n := len(v.TxNums)
value := make([]byte, n*4) value := make([]byte, n*4)
for i, x := range v.TxNums { for i, x := range v.TxNums {
binary.BigEndian.PutUint32(value[i*4:], x) binary.LittleEndian.PutUint32(value[i*4:], x)
} }
return value return value
@ -603,7 +603,7 @@ func HashXHistoryValueUnpack(value []byte) *HashXHistoryValue {
n := len(value) / 4 n := len(value) / 4
txnums := make([]uint32, n) txnums := make([]uint32, n)
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
txnums[i] = binary.BigEndian.Uint32(value[i*4:]) txnums[i] = binary.LittleEndian.Uint32(value[i*4:])
} }
return &HashXHistoryValue{ return &HashXHistoryValue{
TxNums: txnums, TxNums: txnums,