コード例 #1
0
ファイル: balances.go プロジェクト: Roasbeef/versum
func ProcessOutpointImpl(outpoint btcwire.OutPoint, balances bitrie.Bitrie, c comp.C) bitrie.Bitrie {
	loc := bitrie.MakeBits(sha.Hash(outpoint.Hash))

	x, found := balances.Get(loc, c)
	var oi *OutpointInfo
	if found {
		oi = x.(*OutpointInfo)
	} else {
		oi = &OutpointInfo{}
	}

	c.Use(oi)
	oi = oi.Spend(int(outpoint.Index))

	if oi.Empty() {
		return balances.Delete(loc, c)
	} else {
		return balances.Set(loc, oi, c)
	}
}