)
var defaultEntry = map[bc.Hash]bc.Entry{
- bc.Hash{V0: 0}: &bc.Output{
+ bc.Hash{V0: 0}: &bc.IntraChainOutput{
+ Source: &bc.ValueSource{
+ Value: &bc.AssetAmount{
+ AssetId: &bc.AssetID{V0: 0},
+ },
+ },
+ },
+}
+
+var voteEntry = map[bc.Hash]bc.Entry{
+ bc.Hash{V0: 0}: &bc.VoteOutput{
Source: &bc.ValueSource{
Value: &bc.AssetAmount{
AssetId: &bc.AssetID{V0: 0},
}
var gasOnlyTxEntry = map[bc.Hash]bc.Entry{
- bc.Hash{V1: 0}: &bc.Output{
+ bc.Hash{V1: 0}: &bc.IntraChainOutput{
Source: &bc.ValueSource{
Value: &bc.AssetAmount{
AssetId: consensus.BTMAssetID,
},
},
},
- bc.Hash{V1: 1}: &bc.Output{
+ bc.Hash{V1: 1}: &bc.IntraChainOutput{
Source: &bc.ValueSource{
Value: &bc.AssetAmount{
AssetId: &bc.AssetID{V0: 999},
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
fetchView: NewUtxoViewpoint(),
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
err: true,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
err: false,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(true, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.CoinbaseUTXOType, 0, false),
},
},
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(true, 0, true),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.CoinbaseUTXOType, 0, true),
},
},
err: false,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(true, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.CoinbaseUTXOType, 0, false),
},
},
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(true, 0, true),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.CoinbaseUTXOType, 0, true),
},
},
err: true,
inputView: NewUtxoViewpoint(),
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(true, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.CoinbaseUTXOType, 0, false),
},
},
err: false,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V1: 0}: storage.NewUtxoEntry(false, 0, false),
- bc.Hash{V1: 1}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V1: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
+ bc.Hash{V1: 1}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V1: 0}: storage.NewUtxoEntry(false, 0, true),
- bc.Hash{V1: 1}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V1: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
+ bc.Hash{V1: 1}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
gasOnlyTx: true,
inputView: NewUtxoViewpoint(),
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V1: 0}: storage.NewUtxoEntry(true, 0, false),
+ bc.Hash{V1: 0}: storage.NewUtxoEntry(storage.CoinbaseUTXOType, 0, false),
},
},
gasOnlyTx: true,
err: false,
},
+ {
+ block: &bc.Block{
+ BlockHeader: &bc.BlockHeader{
+ TransactionStatus: bc.NewTransactionStatus(),
+ },
+ Transactions: []*bc.Tx{
+ &bc.Tx{
+ TxHeader: &bc.TxHeader{
+ ResultIds: []*bc.Hash{},
+ },
+ SpentOutputIDs: []bc.Hash{
+ bc.Hash{V0: 0},
+ },
+ Entries: voteEntry,
+ },
+ },
+ },
+ inputView: &UtxoViewpoint{
+ Entries: map[bc.Hash]*storage.UtxoEntry{
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.VoteUTXOType, 0, false),
+ },
+ },
+ fetchView: &UtxoViewpoint{
+ Entries: map[bc.Hash]*storage.UtxoEntry{
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.VoteUTXOType, 0, true),
+ },
+ },
+ err: true,
+ },
+ {
+ block: &bc.Block{
+ BlockHeader: &bc.BlockHeader{
+ Height: 10001,
+ TransactionStatus: bc.NewTransactionStatus(),
+ },
+ Transactions: []*bc.Tx{
+ &bc.Tx{
+ TxHeader: &bc.TxHeader{
+ ResultIds: []*bc.Hash{},
+ },
+ SpentOutputIDs: []bc.Hash{
+ bc.Hash{V0: 0},
+ },
+ Entries: voteEntry,
+ },
+ },
+ },
+ inputView: &UtxoViewpoint{
+ Entries: map[bc.Hash]*storage.UtxoEntry{
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.VoteUTXOType, 1, false),
+ },
+ },
+ fetchView: &UtxoViewpoint{
+ Entries: map[bc.Hash]*storage.UtxoEntry{
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.VoteUTXOType, 1, true),
+ },
+ },
+ err: false,
+ },
}
for i, c := range cases {
inputView: NewUtxoViewpoint(),
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
err: false,
inputView: NewUtxoViewpoint(),
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
err: false,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
err: true,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V0: 0}: storage.NewUtxoEntry(false, 0, false),
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
},
},
err: false,
},
inputView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V1: 0}: storage.NewUtxoEntry(false, 0, true),
- bc.Hash{V1: 1}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V1: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
+ bc.Hash{V1: 1}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V1: 0}: storage.NewUtxoEntry(false, 0, false),
- bc.Hash{V1: 1}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V1: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, false),
+ bc.Hash{V1: 1}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
gasOnlyTx: true,
inputView: NewUtxoViewpoint(),
fetchView: &UtxoViewpoint{
Entries: map[bc.Hash]*storage.UtxoEntry{
- bc.Hash{V1: 0}: storage.NewUtxoEntry(false, 0, true),
+ bc.Hash{V1: 0}: storage.NewUtxoEntry(storage.NormalUTXOType, 0, true),
},
},
gasOnlyTx: true,
err: false,
},
+ {
+ block: &bc.Block{
+ BlockHeader: &bc.BlockHeader{
+ TransactionStatus: bc.NewTransactionStatus(),
+ },
+ Transactions: []*bc.Tx{
+ &bc.Tx{
+ TxHeader: &bc.TxHeader{
+ ResultIds: []*bc.Hash{},
+ },
+ SpentOutputIDs: []bc.Hash{
+ bc.Hash{V0: 0},
+ },
+ Entries: voteEntry,
+ },
+ },
+ },
+ inputView: NewUtxoViewpoint(),
+ fetchView: &UtxoViewpoint{
+ Entries: map[bc.Hash]*storage.UtxoEntry{
+ bc.Hash{V0: 0}: storage.NewUtxoEntry(storage.VoteUTXOType, 0, false),
+ },
+ },
+ err: false,
+ },
}
for i, c := range cases {