X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=test%2Fchain_test_util.go;h=9181053f7d3d6a68d80a1bee32d650b2a24ce7ac;hb=f3267d4dab32355bc233ae8be5f322cb039dfc59;hp=31e72899dca46d51f88822d99d4ef5549719a514;hpb=db158dcf09436b003defd333f1a665e7e051d820;p=bytom%2Fvapor.git diff --git a/test/chain_test_util.go b/test/chain_test_util.go index 31e72899..9181053f 100644 --- a/test/chain_test_util.go +++ b/test/chain_test_util.go @@ -62,13 +62,26 @@ func (ctx *chainTestContext) validateStatus(block *types.Block) error { func (ctx *chainTestContext) validateExecution(block *types.Block) error { for _, tx := range block.Transactions { + for _, mainchainOutputID := range tx.MainchainOutputIDs { + utxoEntry, _ := ctx.Store.GetUtxo(&mainchainOutputID) + if utxoEntry == nil { + continue + } + if utxoEntry.Type != storage.CrosschainUTXOType { + return fmt.Errorf("found non-mainchain utxo entry") + } + if !utxoEntry.Spent { + return fmt.Errorf("utxo entry status should be spent") + } + } + for _, spentOutputID := range tx.SpentOutputIDs { utxoEntry, _ := ctx.Store.GetUtxo(&spentOutputID) if utxoEntry == nil { continue } - if !utxoEntry.IsCoinBase { - return fmt.Errorf("found non-coinbase spent utxo entry") + if utxoEntry.Type == storage.NormalUTXOType { + return fmt.Errorf("found normal utxo entry") } if !utxoEntry.Spent { return fmt.Errorf("utxo entry status should be spent") @@ -208,7 +221,7 @@ func (t *ctTransaction) createTransaction(ctx *chainTestContext, txs []*types.Tx } for _, amount := range t.Outputs { - output := types.NewTxOutput(*consensus.BTMAssetID, amount, []byte{byte(vm.OP_TRUE)}) + output := types.NewIntraChainOutput(*consensus.BTMAssetID, amount, []byte{byte(vm.OP_TRUE)}) if err := builder.AddOutput(output); err != nil { return nil, err } @@ -249,7 +262,7 @@ func (cfg *chainTestConfig) Run() error { if err != nil { return err } - err = SolveAndUpdate(ctx.Chain, block) + _, err = ctx.Chain.ProcessBlock(block) if err != nil && blk.Invalid { continue }