blob: 4281ac128bcea55d342ca01b99699382c82642cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package coindatabase
import "Chain/pkg/block"
// Coin is used by the CoinDatabase to keep track of unspent
// TransactionOutputs.
// TransactionOutput is the underlying TransactionOutput.
// IsSpent is whether that TransactionOutput has been spent.
// Active is whether that TransactionOutput is one created by
// Blocks on the active Chain.
type Coin struct {
TransactionOutput *block.TransactionOutput
IsSpent bool
}
// CoinLocator is a dumbed down TransactionInput, used
// as a key to Coins in the CoinDatabase's mainCache.
type CoinLocator struct {
ReferenceTransactionHash string
OutputIndex uint32
}
// makeCoinLocator returns a CoinLocator given a TransactionInput.
func makeCoinLocator(txi *block.TransactionInput) CoinLocator {
return CoinLocator{
ReferenceTransactionHash: txi.ReferenceTransactionHash,
OutputIndex: txi.OutputIndex,
}
}
|