Fix spent computation on a multiple of 8 txout tx.
This commit is contained in:
parent
bee05db603
commit
92651c6d13
1 changed files with 4 additions and 2 deletions
|
@ -678,8 +678,10 @@ func (db *SqliteDb) InsertBlock(block *btcutil.Block) (height int64, err error)
|
|||
}
|
||||
spentbuflen := (len(tx.TxOut) + 7) / 8
|
||||
spentbuf := make([]byte, spentbuflen, spentbuflen)
|
||||
for i := uint(len(tx.TxOut) % 8); i < 8; i++ {
|
||||
spentbuf[spentbuflen-1] |= (byte(1) << i)
|
||||
if len(tx.TxOut)%8 != 0 {
|
||||
for i := uint(len(tx.TxOut) % 8); i < 8; i++ {
|
||||
spentbuf[spentbuflen-1] |= (byte(1) << i)
|
||||
}
|
||||
}
|
||||
|
||||
err = db.insertTx(&txsha, newheight, txloc[txidx].TxStart, txloc[txidx].TxLen, spentbuf)
|
||||
|
|
Loading…
Reference in a new issue