Fix order of utxos

pull/380/head
Martin Boehm 2020-02-14 16:54:51 +01:00
parent 7f46fbab0d
commit 1b713308a3
1 changed files with 8 additions and 0 deletions

View File

@ -1884,6 +1884,14 @@ func (d *RocksDB) fixUtxo(addrDesc bchain.AddressDescriptor, ba *AddrBalance) (b
}
prevUtxo = utxo
}
if reorder {
// get the checksum again after reorder
checksum.SetInt64(0)
for i := range ba.Utxos {
utxo := &ba.Utxos[i]
checksum.Add(&checksum, &utxo.ValueSat)
}
}
if checksum.Cmp(&ba.BalanceSat) != 0 {
var checksumFromTxs big.Int
var utxos []Utxo