OSDN Git Service

Bvm (#138)
authorPaladz <yzhu101@uottawa.ca>
Tue, 28 Nov 2017 15:32:27 +0000 (23:32 +0800)
committerGitHub <noreply@github.com>
Tue, 28 Nov 2017 15:32:27 +0000 (23:32 +0800)
* delete unused parameters from chain core

* add unit test for snapshot tree proto

46 files changed:
blockchain/transact.go
blockchain/txbuilder/builder.go
blockchain/txbuilder/constraint.go
blockchain/txbuilder/finalize.go
blockchain/txbuilder/witness.go
blockchain/txbuilder/witness_test.go
blockchain/txdb/snapshot_test.go
config/genesis.go
exp/ivy/compiler/compile_test.go
protocol/bc/asset.go
protocol/bc/bc.pb.go
protocol/bc/bc.proto
protocol/bc/bctest/tx.go
protocol/bc/doc.go [deleted file]
protocol/bc/entry.go
protocol/bc/entry_test.go
protocol/bc/hash.go
protocol/bc/legacy/block.go
protocol/bc/legacy/block_commitment.go
protocol/bc/legacy/block_header.go
protocol/bc/legacy/block_test.go
protocol/bc/legacy/fuzz_test.go
protocol/bc/legacy/map.go
protocol/bc/legacy/map_test.go
protocol/bc/legacy/output_commitment.go
protocol/bc/legacy/transaction.go
protocol/bc/legacy/transaction_test.go
protocol/bc/legacy/tx_test.go
protocol/bc/legacy/txinput.go
protocol/bc/legacy/txoutput.go
protocol/bc/merkle_test.go
protocol/bc/txheader.go
protocol/patricia/patricia.go
protocol/state/snapshot.go
protocol/state/snapshot_test.go
protocol/tx.go
protocol/tx_test.go
protocol/validation/validation.go
protocol/validation/validation_test.go
protocol/validation/vmcontext.go
protocol/validation/vmcontext_test.go
protocol/vm/context.go
protocol/vm/introspection.go
protocol/vm/introspection_test.go
protocol/vm/ops.go
protocol/vm/vm_test.go

index 6401e79..45aae11 100644 (file)
@@ -190,10 +190,6 @@ func (a *BlockchainReactor) waitForTxInBlock(ctx context.Context, tx *legacy.Tx,
                                }
                        }
 
-                       if tx.MaxTime > 0 && tx.MaxTime < b.TimestampMS {
-                               return 0, errors.Wrap(txbuilder.ErrRejected, "transaction max time exceeded")
-                       }
-
                        // might still be in pool or might be rejected; we can't
                        // tell definitively until its max time elapses.
                        // Re-insert into the pool in case it was dropped.
index d582348..1b4a254 100644 (file)
@@ -6,7 +6,6 @@ import (
        "time"
 
        "github.com/bytom/errors"
-       "github.com/bytom/protocol/bc"
        "github.com/bytom/protocol/bc/legacy"
 )
 
@@ -111,14 +110,6 @@ func (b *TemplateBuilder) Build() (*Template, *legacy.TxData, error) {
                tpl.Local = true
        }
 
-       // Update min & max times.
-       if !b.minTime.IsZero() && bc.Millis(b.minTime) > tx.MinTime {
-               tx.MinTime = bc.Millis(b.minTime)
-       }
-       if tx.MaxTime == 0 || tx.MaxTime > bc.Millis(b.maxTime) {
-               tx.MaxTime = bc.Millis(b.maxTime)
-       }
-
        // Set transaction reference data if applicable.
        if len(b.referenceData) > 0 {
                tx.ReferenceData = b.referenceData
index 467b129..62ddf4c 100644 (file)
@@ -17,34 +17,6 @@ type constraint interface {
        code() []byte
 }
 
-// timeConstraint means the tx is only valid within the given time
-// bounds.  Either value is allowed to be 0 meaning "ignore."
-type timeConstraint struct {
-       minTimeMS, maxTimeMS uint64
-}
-
-func (t timeConstraint) code() []byte {
-       if t.minTimeMS == 0 && t.maxTimeMS == 0 {
-               return []byte{byte(vm.OP_TRUE)}
-       }
-       builder := vmutil.NewBuilder()
-       if t.minTimeMS > 0 {
-               builder.AddOp(vm.OP_MINTIME).AddInt64(int64(t.minTimeMS)).AddOp(vm.OP_GREATERTHANOREQUAL)
-       }
-       if t.maxTimeMS > 0 {
-               if t.minTimeMS > 0 {
-                       // Consume the boolean left by the "mintime" clause, failing
-                       // immediately if it's false, so that the result of the
-                       // "maxtime" clause below is really (mintime clause && maxtime
-                       // clause).
-                       builder.AddOp(vm.OP_VERIFY)
-               }
-               builder.AddOp(vm.OP_MAXTIME).AddInt64(int64(t.maxTimeMS)).AddOp(vm.OP_LESSTHANOREQUAL)
-       }
-       prog, _ := builder.Build() // error is impossible
-       return prog
-}
-
 // outpointConstraint requires the outputID (and therefore, the outpoint) being spent to equal the
 // given value.
 type outputIDConstraint bc.Hash
index 267b23f..66b834b 100644 (file)
@@ -27,9 +27,6 @@ func FinalizeTx(ctx context.Context, c *protocol.Chain, tx *legacy.Tx) error {
                return err
        }
 
-       if tx.Tx.MaxTimeMs > 0 && tx.Tx.MaxTimeMs < c.TimestampMS() {
-               return errors.Wrap(ErrRejected, "tx expired")
-       }
        err = c.ValidateTx(tx)
        if errors.Root(err) == protocol.ErrBadTx {
                return errors.Sub(ErrRejected, err)
index 7aae8d9..5543e2a 100644 (file)
@@ -148,10 +148,6 @@ func buildSigProgram(tpl *Template, index uint32) []byte {
                return prog
        }
        constraints := make([]constraint, 0, 3+len(tpl.Transaction.Outputs))
-       constraints = append(constraints, &timeConstraint{
-               minTimeMS: tpl.Transaction.MinTime,
-               maxTimeMS: tpl.Transaction.MaxTime,
-       })
        id := tpl.Transaction.Tx.InputIDs[index]
        if sp, err := tpl.Transaction.Tx.Spend(id); err == nil {
                constraints = append(constraints, outputIDConstraint(*sp.SpentOutputId))
index 296c06f..153d1ac 100644 (file)
@@ -24,8 +24,6 @@ func TestInferConstraints(t *testing.T) {
                        Outputs: []*legacy.TxOutput{
                                legacy.NewTxOutput(bc.AssetID{}, 123, []byte{10, 11, 12}, nil),
                        },
-                       MinTime: 1,
-                       MaxTime: 2,
                }),
                AllowAdditional: true,
        }
@@ -35,7 +33,7 @@ func TestInferConstraints(t *testing.T) {
        if err != nil {
                t.Fatal(err)
        }
-       wantSrc := fmt.Sprintf("MINTIME 1 GREATERTHANOREQUAL VERIFY MAXTIME 2 LESSTHANOREQUAL VERIFY 0x%x OUTPUTID EQUAL VERIFY 0x2767f15c8af2f2c7225d5273fdd683edc714110a987d1054697c348aed4e6cc7 ENTRYDATA EQUAL VERIFY 0 0 123 0x0000000000000000000000000000000000000000000000000000000000000000 1 0x0a0b0c CHECKOUTPUT", spend.SpentOutputId.Bytes())
+       wantSrc := fmt.Sprintf("0x%x OUTPUTID EQUAL VERIFY 0x2767f15c8af2f2c7225d5273fdd683edc714110a987d1054697c348aed4e6cc7 ENTRYDATA EQUAL VERIFY 0 0 123 0x0000000000000000000000000000000000000000000000000000000000000000 1 0x0a0b0c CHECKOUTPUT", spend.SpentOutputId.Bytes())
        want, err := vm.Assemble(wantSrc)
        if err != nil {
                t.Fatal(err)
index 75d1098..ad03729 100644 (file)
@@ -8,8 +8,39 @@ import (
        dbm "github.com/tendermint/tmlibs/db"
 
        "github.com/bytom/protocol/bc"
+       "github.com/bytom/protocol/state"
 )
 
+func TestProtoSnapshotTree(t *testing.T) {
+       testDB := dbm.NewDB("testdb", "leveldb", "temp")
+       defer os.RemoveAll("temp")
+
+       hashes := []bc.Hash{}
+       insertSnap := state.Empty()
+
+       hash := bc.Hash{}
+       for i := uint64(0); i <= uint64(10); i++ {
+               hash.V0 = i
+               hashes = append(hashes, hash)
+               insertSnap.Tree.Insert(hash.Bytes())
+       }
+
+       if err := saveSnapshot(testDB, insertSnap, &hash); err != nil {
+               t.Errorf(err.Error())
+       }
+
+       popSnap, err := getSnapshot(testDB, &hash)
+       if err != nil {
+               t.Errorf(err.Error())
+       }
+
+       for _, h := range hashes {
+               if !popSnap.Tree.Contains(h.Bytes()) {
+                       t.Errorf("%s isn't in the snap tree", h.String())
+               }
+       }
+}
+
 func TestCleanSnapshotDB(t *testing.T) {
        testDB := dbm.NewDB("testdb", "leveldb", "temp")
        defer os.RemoveAll("temp")
index c6df4bf..1fbe28c 100644 (file)
@@ -3,20 +3,20 @@ package config
 import (
        log "github.com/sirupsen/logrus"
 
-       "github.com/bytom/protocol/bc/legacy"
-       "github.com/bytom/protocol/bc"
        "github.com/bytom/consensus"
-       "github.com/bytom/protocol/state"
        "github.com/bytom/crypto/sha3pool"
+       "github.com/bytom/protocol/bc"
+       "github.com/bytom/protocol/bc/legacy"
+       "github.com/bytom/protocol/state"
 )
 
 // Generate genesis transaction
 func GenerateGenesisTx() *legacy.Tx {
        txData := legacy.TxData{
-               Version: 1,
+               Version:        1,
                SerializedSize: 63,
-               Inputs: []*legacy.TxInput{},
-               Outputs:[]*legacy.TxOutput{
+               Inputs:         []*legacy.TxInput{},
+               Outputs: []*legacy.TxOutput{
                        &legacy.TxOutput{
                                AssetVersion: 1,
                                OutputCommitment: legacy.OutputCommitment{
@@ -29,8 +29,6 @@ func GenerateGenesisTx() *legacy.Tx {
                                },
                        },
                },
-               MinTime: 0,
-               MaxTime: 1511318565142,
        }
 
        return legacy.NewTx(txData)
@@ -53,10 +51,10 @@ func GenerateGenesisBlock() *legacy.Block {
        sha3pool.Sum256(seed[:], make([]byte, 32))
 
        genesisBlock := &legacy.Block{
-               BlockHeader:  legacy.BlockHeader{
-                       Version: 1,
-                       Height: 1,
-                       Seed: bc.NewHash(seed),
+               BlockHeader: legacy.BlockHeader{
+                       Version:     1,
+                       Height:      1,
+                       Seed:        bc.NewHash(seed),
                        TimestampMS: 1511318565142,
                        BlockCommitment: legacy.BlockCommitment{
                                TransactionsMerkleRoot: merkleRoot,
index 745c431..6780df6 100644 (file)
@@ -51,30 +51,15 @@ func TestCompile(t *testing.T) {
                        `[{"name":"EscrowedTransfer","params":[{"name":"agent","declared_type":"PublicKey"},{"name":"sender","declared_type":"Program"},{"name":"recipient","declared_type":"Program"}],"clauses":[{"name":"approve","params":[{"name":"sig","declared_type":"Signature"}],"values":[{"name":"value","program":"recipient"}]},{"name":"reject","params":[{"name":"sig","declared_type":"Signature"}],"values":[{"name":"value","program":"sender"}]}],"value":"value","body_bytecode":"537a641b000000537a7cae7cac690000c3c251567ac1632a000000537a7cae7cac690000c3c251557ac1","body_opcodes":"3 ROLL JUMPIF:$reject $approve 3 ROLL SWAP TXSIGHASH SWAP CHECKSIG VERIFY 0 0 AMOUNT ASSET 1 6 ROLL CHECKOUTPUT JUMP:$_end $reject 3 ROLL SWAP TXSIGHASH SWAP CHECKSIG VERIFY 0 0 AMOUNT ASSET 1 5 ROLL CHECKOUTPUT $_end","recursive":false}]`,
                },
                {
-                       "CollateralizedLoan",
-                       ivytest.CollateralizedLoan,
-                       `[{"name":"CollateralizedLoan","params":[{"name":"balanceAsset","declared_type":"Asset"},{"name":"balanceAmount","declared_type":"Amount"},{"name":"deadline","declared_type":"Time"},{"name":"lender","declared_type":"Program"},{"name":"borrower","declared_type":"Program"}],"clauses":[{"name":"repay","reqs":[{"name":"payment","asset":"balanceAsset","amount":"balanceAmount"}],"values":[{"name":"payment","program":"lender","asset":"balanceAsset","amount":"balanceAmount"},{"name":"collateral","program":"borrower"}]},{"name":"default","mintimes":["deadline"],"values":[{"name":"collateral","program":"lender"}]}],"value":"collateral","body_bytecode":"557a641c00000000007251567ac1695100c3c251567ac163280000007bc59f690000c3c251577ac1","body_opcodes":"5 ROLL JUMPIF:$default $repay 0 0 2SWAP 1 6 ROLL CHECKOUTPUT VERIFY 1 0 AMOUNT ASSET 1 6 ROLL CHECKOUTPUT JUMP:$_end $default ROT MINTIME LESSTHAN VERIFY 0 0 AMOUNT ASSET 1 7 ROLL CHECKOUTPUT $_end","recursive":false}]`,
-               },
-               {
                        "RevealPreimage",
                        ivytest.RevealPreimage,
                        `[{"name":"RevealPreimage","params":[{"name":"hash","declared_type":"Hash","inferred_type":"Sha3(String)"}],"clauses":[{"name":"reveal","params":[{"name":"string","declared_type":"String"}],"hash_calls":[{"hash_type":"sha3","arg":"string","arg_type":"String"}],"values":[{"name":"value"}]}],"value":"value","body_bytecode":"7caa87","body_opcodes":"SWAP SHA3 EQUAL","recursive":false}]`,
                },
                {
-                       "CallOptionWithSettlement",
-                       ivytest.CallOptionWithSettlement,
-                       `[{"name":"CallOptionWithSettlement","params":[{"name":"strikePrice","declared_type":"Amount"},{"name":"strikeCurrency","declared_type":"Asset"},{"name":"sellerProgram","declared_type":"Program"},{"name":"sellerKey","declared_type":"PublicKey"},{"name":"buyerKey","declared_type":"PublicKey"},{"name":"deadline","declared_type":"Time"}],"clauses":[{"name":"exercise","params":[{"name":"buyerSig","declared_type":"Signature"}],"reqs":[{"name":"payment","asset":"strikeCurrency","amount":"strikePrice"}],"maxtimes":["deadline"],"values":[{"name":"payment","program":"sellerProgram","asset":"strikeCurrency","amount":"strikePrice"},{"name":"underlying"}]},{"name":"expire","mintimes":["deadline"],"values":[{"name":"underlying","program":"sellerProgram"}]},{"name":"settle","params":[{"name":"sellerSig","declared_type":"Signature"},{"name":"buyerSig","declared_type":"Signature"}],"values":[{"name":"underlying"}]}],"value":"underlying","body_bytecode":"567a76529c64390000006427000000557ac6a06971ae7cac6900007b537a51557ac16349000000557ac59f690000c3c251577ac1634900000075577a547aae7cac69557a547aae7cac","body_opcodes":"6 ROLL DUP 2 NUMEQUAL JUMPIF:$settle JUMPIF:$expire $exercise 5 ROLL MAXTIME GREATERTHAN VERIFY 2ROT TXSIGHASH SWAP CHECKSIG VERIFY 0 0 ROT 3 ROLL 1 5 ROLL CHECKOUTPUT JUMP:$_end $expire 5 ROLL MINTIME LESSTHAN VERIFY 0 0 AMOUNT ASSET 1 7 ROLL CHECKOUTPUT JUMP:$_end $settle DROP 7 ROLL 4 ROLL TXSIGHASH SWAP CHECKSIG VERIFY 5 ROLL 4 ROLL TXSIGHASH SWAP CHECKSIG $_end","recursive":false}]`,
-               },
-               {
                        "PriceChanger",
                        ivytest.PriceChanger,
                        `[{"name":"PriceChanger","params":[{"name":"askAmount","declared_type":"Amount"},{"name":"askAsset","declared_type":"Asset"},{"name":"sellerKey","declared_type":"PublicKey"},{"name":"sellerProg","declared_type":"Program"}],"clauses":[{"name":"changePrice","params":[{"name":"newAmount","declared_type":"Amount"},{"name":"newAsset","declared_type":"Asset"},{"name":"sig","declared_type":"Signature"}],"values":[{"name":"offered","program":"PriceChanger(newAmount, newAsset, sellerKey, sellerProg)"}],"contracts":["PriceChanger"]},{"name":"redeem","reqs":[{"name":"payment","asset":"askAsset","amount":"askAmount"}],"values":[{"name":"payment","program":"sellerProg","asset":"askAsset","amount":"askAmount"},{"name":"offered"}]}],"value":"offered","body_bytecode":"557a6433000000557a5479ae7cac690000c3c251005a7a89597a89597a89597a89567a890274787e008901c07ec1633d0000000000537a547a51577ac1","body_opcodes":"5 ROLL JUMPIF:$redeem $changePrice 5 ROLL 4 PICK TXSIGHASH SWAP CHECKSIG VERIFY 0 0 AMOUNT ASSET 1 0 10 ROLL CATPUSHDATA 9 ROLL CATPUSHDATA 9 ROLL CATPUSHDATA 9 ROLL CATPUSHDATA 6 ROLL CATPUSHDATA 0x7478 CAT 0 CATPUSHDATA 192 CAT CHECKOUTPUT JUMP:$_end $redeem 0 0 3 ROLL 4 ROLL 1 7 ROLL CHECKOUTPUT $_end","recursive":true}]`,
                },
-               {
-                       "OneTwo",
-                       ivytest.OneTwo,
-                       `[{"name":"Two","params":[{"name":"b","declared_type":"Program"},{"name":"c","declared_type":"Program"},{"name":"expirationTime","declared_type":"Time"}],"clauses":[{"name":"redeem","maxtimes":["expirationTime"],"values":[{"name":"value","program":"b"}]},{"name":"default","mintimes":["expirationTime"],"values":[{"name":"value","program":"c"}]}],"value":"value","body_bytecode":"537a64180000007bc6a0690000c3c251557ac163240000007bc59f690000c3c251567ac1","body_opcodes":"3 ROLL JUMPIF:$default $redeem ROT MAXTIME GREATERTHAN VERIFY 0 0 AMOUNT ASSET 1 5 ROLL CHECKOUTPUT JUMP:$_end $default ROT MINTIME LESSTHAN VERIFY 0 0 AMOUNT ASSET 1 6 ROLL CHECKOUTPUT $_end","recursive":false},{"name":"One","params":[{"name":"a","declared_type":"Program"},{"name":"b","declared_type":"Program"},{"name":"c","declared_type":"Program"},{"name":"switchTime","declared_type":"Time"},{"name":"expirationTime","declared_type":"Time"}],"clauses":[{"name":"redeem","maxtimes":["switchTime"],"values":[{"name":"value","program":"a"}]},{"name":"switch","mintimes":["switchTime"],"values":[{"name":"value","program":"Two(b, c, expirationTime)"}],"contracts":["Two"]}],"value":"value","body_bytecode":"557a6419000000537ac6a0690000c3c251557ac1635c000000537ac59f690000c3c25100597a89587a89577a8901747e24537a64180000007bc6a0690000c3c251557ac163240000007bc59f690000c3c251567ac189008901c07ec1","body_opcodes":"5 ROLL JUMPIF:$switch $redeem 3 ROLL MAXTIME GREATERTHAN VERIFY 0 0 AMOUNT ASSET 1 5 ROLL CHECKOUTPUT JUMP:$_end $switch 3 ROLL MINTIME LESSTHAN VERIFY 0 0 AMOUNT ASSET 1 0 9 ROLL CATPUSHDATA 8 ROLL CATPUSHDATA 7 ROLL CATPUSHDATA 116 CAT 0x537a64180000007bc6a0690000c3c251557ac163240000007bc59f690000c3c251567ac1 CATPUSHDATA 0 CATPUSHDATA 192 CAT CHECKOUTPUT $_end","recursive":false}]`,
-               },
        }
        for _, c := range cases {
                t.Run(c.name, func(t *testing.T) {
index c330738..4791a49 100644 (file)
@@ -47,10 +47,9 @@ func ComputeAssetID(prog []byte, initialBlockID *Hash, vmVersion uint64, data *H
        return def.ComputeAssetID()
 }
 
-func (a *AssetAmount) ReadFrom(r *blockchain.Reader) error {
+func (a *AssetAmount) ReadFrom(r *blockchain.Reader) (err error) {
        var assetID AssetID
-       _, err := assetID.ReadFrom(r)
-       if err != nil {
+       if _, err = assetID.ReadFrom(r); err != nil {
                return err
        }
        a.AssetId = &assetID
index 9162ddd..705a872 100644 (file)
@@ -364,9 +364,7 @@ type TxHeader struct {
        SerializedSize uint64  `protobuf:"varint,2,opt,name=serialized_size,json=serializedSize" json:"serialized_size,omitempty"`
        ResultIds      []*Hash `protobuf:"bytes,3,rep,name=result_ids,json=resultIds" json:"result_ids,omitempty"`
        Data           *Hash   `protobuf:"bytes,4,opt,name=data" json:"data,omitempty"`
-       MinTimeMs      uint64  `protobuf:"varint,5,opt,name=min_time_ms,json=minTimeMs" json:"min_time_ms,omitempty"`
-       MaxTimeMs      uint64  `protobuf:"varint,6,opt,name=max_time_ms,json=maxTimeMs" json:"max_time_ms,omitempty"`
-       ExtHash        *Hash   `protobuf:"bytes,7,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
+       ExtHash        *Hash   `protobuf:"bytes,5,opt,name=ext_hash,json=extHash" json:"ext_hash,omitempty"`
 }
 
 func (m *TxHeader) Reset()                    { *m = TxHeader{} }
@@ -402,20 +400,6 @@ func (m *TxHeader) GetData() *Hash {
        return nil
 }
 
-func (m *TxHeader) GetMinTimeMs() uint64 {
-       if m != nil {
-               return m.MinTimeMs
-       }
-       return 0
-}
-
-func (m *TxHeader) GetMaxTimeMs() uint64 {
-       if m != nil {
-               return m.MaxTimeMs
-       }
-       return 0
-}
-
 func (m *TxHeader) GetExtHash() *Hash {
        if m != nil {
                return m.ExtHash
@@ -781,65 +765,63 @@ func init() {
 func init() { proto.RegisterFile("bc.proto", fileDescriptor0) }
 
 var fileDescriptor0 = []byte{
-       // 956 bytes of a gzipped FileDescriptorProto
-       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4b, 0x6f, 0xdb, 0x46,
-       0x10, 0x06, 0x45, 0x4a, 0xa4, 0x46, 0xa9, 0x25, 0xaf, 0x8d, 0x80, 0x08, 0xd2, 0x22, 0x65, 0xe1,
-       0x3a, 0x41, 0x01, 0xc3, 0x91, 0xd3, 0xa2, 0x87, 0x5e, 0xdc, 0xba, 0x6d, 0x74, 0x50, 0x1f, 0x74,
-       0x90, 0x2b, 0xb1, 0x22, 0x37, 0xd6, 0xa2, 0xe2, 0xae, 0xca, 0x5d, 0xaa, 0x82, 0x7f, 0x46, 0xaf,
-       0xfd, 0x17, 0x3d, 0xf6, 0x9c, 0x7f, 0xd3, 0x5b, 0x6f, 0xbd, 0x15, 0x1c, 0x2e, 0xa9, 0x87, 0xa5,
-       0x44, 0x42, 0xd2, 0x1b, 0xe7, 0xc1, 0x79, 0x7c, 0x33, 0xdf, 0xee, 0x82, 0x37, 0x8a, 0xcf, 0xa6,
-       0x99, 0xd4, 0x92, 0x34, 0x46, 0x71, 0xf0, 0x1d, 0x38, 0xcf, 0xa9, 0x1a, 0x93, 0x03, 0x68, 0xcc,
-       0xce, 0x7d, 0xeb, 0x91, 0xf5, 0xb8, 0x15, 0x36, 0x66, 0xe7, 0x28, 0x3f, 0xf5, 0x1b, 0x46, 0x7e,
-       0x8a, 0x72, 0xdf, 0xb7, 0x8d, 0xdc, 0x47, 0xf9, 0xc2, 0x77, 0x8c, 0x7c, 0x11, 0x7c, 0x05, 0xee,
-       0x4f, 0x99, 0xbc, 0xc9, 0x68, 0x4a, 0x3e, 0x04, 0x98, 0xa5, 0xd1, 0x8c, 0x65, 0x8a, 0x4b, 0x81,
-       0x21, 0x9d, 0xb0, 0x3d, 0x4b, 0x5f, 0x96, 0x0a, 0x42, 0xc0, 0x89, 0x65, 0xc2, 0x30, 0xf6, 0xbd,
-       0x10, 0xbf, 0x83, 0x01, 0xb8, 0x97, 0x4a, 0x31, 0x3d, 0xb8, 0x7a, 0xe7, 0x42, 0x86, 0xd0, 0xc1,
-       0x50, 0x97, 0xa9, 0xcc, 0x85, 0x26, 0x9f, 0x82, 0x47, 0x0b, 0x31, 0xe2, 0x09, 0x06, 0xed, 0xf4,
-       0x3b, 0x67, 0xa3, 0xf8, 0xcc, 0x64, 0x0b, 0x5d, 0x34, 0x0e, 0x12, 0x72, 0x1f, 0x5a, 0x14, 0xff,
-       0xc0, 0x54, 0x4e, 0x68, 0xa4, 0xe0, 0x0f, 0x0b, 0xba, 0xe8, 0x7c, 0xc5, 0x5e, 0x71, 0xc1, 0x75,
-       0xd1, 0x41, 0x1f, 0x7a, 0xf8, 0x49, 0x27, 0xd1, 0x68, 0x22, 0xe3, 0x5f, 0x16, 0xb1, 0xbd, 0x22,
-       0x76, 0x81, 0x67, 0x78, 0x60, 0x3c, 0xbe, 0x2e, 0x1c, 0x06, 0x09, 0xf9, 0x02, 0x7a, 0x5c, 0xa9,
-       0x9c, 0x8a, 0x98, 0x45, 0xd3, 0x12, 0x28, 0xcc, 0x64, 0xea, 0x31, 0xd8, 0x85, 0xdd, 0xca, 0xa9,
-       0x02, 0xf3, 0x21, 0x38, 0x09, 0xd5, 0x14, 0x1b, 0x5e, 0x8e, 0x8f, 0xda, 0x60, 0x02, 0x9d, 0x97,
-       0x74, 0x92, 0xb3, 0x6b, 0x99, 0x67, 0x31, 0x23, 0x0f, 0xc0, 0xce, 0xd8, 0xab, 0x3b, 0xb5, 0x14,
-       0x4a, 0x72, 0x02, 0xcd, 0x59, 0xe1, 0x6a, 0xb2, 0x76, 0x6b, 0x14, 0x4a, 0xa0, 0xc2, 0xd2, 0x4a,
-       0x1e, 0x80, 0x37, 0x95, 0x0a, 0xfb, 0xc4, 0x9c, 0x4e, 0x58, 0xcb, 0xc1, 0xaf, 0xd0, 0xc3, 0x6c,
-       0x57, 0x4c, 0x69, 0x2e, 0x28, 0x62, 0xf1, 0x3f, 0xa7, 0xfc, 0xbb, 0x01, 0x1d, 0x84, 0xf0, 0x39,
-       0xa3, 0x09, 0xcb, 0x88, 0x0f, 0xee, 0xea, 0x62, 0x55, 0x22, 0x39, 0x85, 0xae, 0x62, 0x19, 0xa7,
-       0x13, 0x7e, 0xcb, 0x92, 0x48, 0xf1, 0x5b, 0x66, 0x26, 0x79, 0xb0, 0x50, 0x5f, 0xf3, 0x5b, 0x56,
-       0x4c, 0x7a, 0xcc, 0xf8, 0xcd, 0x58, 0x9b, 0x64, 0x46, 0x22, 0xcf, 0xe0, 0x70, 0x9a, 0xb1, 0x19,
-       0x97, 0xb9, 0x5a, 0x8c, 0xd5, 0x59, 0xeb, 0xab, 0x5b, 0xb9, 0x54, 0x73, 0x7d, 0x08, 0x8e, 0x62,
-       0x2c, 0xf1, 0x9b, 0xeb, 0xf3, 0x29, 0xb4, 0xe4, 0x63, 0xb8, 0xa7, 0x79, 0xca, 0x94, 0xa6, 0xe9,
-       0x34, 0x4a, 0x95, 0xdf, 0xc2, 0x8c, 0x9d, 0x5a, 0x37, 0x54, 0xe4, 0x73, 0x38, 0xd4, 0x19, 0x15,
-       0x8a, 0xc6, 0x45, 0xc3, 0x2a, 0xca, 0xa4, 0xd4, 0xbe, 0xbb, 0x16, 0xad, 0xb7, 0xec, 0x12, 0x4a,
-       0xa9, 0xc9, 0x13, 0xe8, 0xe0, 0xea, 0x9a, 0x1f, 0xbc, 0xb5, 0x1f, 0xa0, 0x34, 0xa2, 0xeb, 0x31,
-       0x34, 0x85, 0x14, 0x31, 0xf3, 0xdb, 0x98, 0xbd, 0x14, 0x0a, 0x1a, 0x8e, 0xb8, 0x56, 0x3e, 0xa0,
-       0x12, 0xbf, 0x83, 0x7f, 0x2d, 0xf0, 0x5e, 0xcc, 0xdf, 0x1f, 0xd4, 0xa7, 0x00, 0x19, 0x53, 0xf9,
-       0xa4, 0x60, 0x9f, 0xf2, 0xed, 0x47, 0xf6, 0x4a, 0x8d, 0xed, 0xd2, 0x36, 0x48, 0x54, 0xbd, 0xe5,
-       0xce, 0xa6, 0x2d, 0x27, 0x1f, 0x41, 0x27, 0xe5, 0x22, 0x2a, 0x50, 0x2b, 0x40, 0x6c, 0x96, 0x27,
-       0x4a, 0xca, 0xc5, 0x0b, 0x9e, 0xb2, 0xa1, 0x42, 0x3b, 0x9d, 0xd7, 0xf6, 0x96, 0xb1, 0xd3, 0xb9,
-       0xb1, 0x7f, 0x02, 0x1e, 0x9b, 0xeb, 0x68, 0x4c, 0xd5, 0xf8, 0x0e, 0xb2, 0x2e, 0x9b, 0xeb, 0xe2,
-       0x23, 0xf8, 0xc7, 0x02, 0x7b, 0x98, 0xcf, 0xc9, 0x13, 0x70, 0x15, 0xb2, 0x49, 0xf9, 0x16, 0x16,
-       0x8c, 0x6b, 0xbb, 0xc4, 0xb2, 0xb0, 0xb2, 0x93, 0x13, 0x70, 0xdf, 0x40, 0xe5, 0xca, 0xb6, 0x92,
-       0xde, 0xde, 0x92, 0x9e, 0x7c, 0x0f, 0xc7, 0xbf, 0x71, 0x2d, 0x98, 0x52, 0x51, 0xb2, 0xa0, 0x97,
-       0xf2, 0x1d, 0xac, 0xe1, 0xb8, 0xae, 0x61, 0x89, 0x7b, 0xe1, 0x91, 0xf9, 0x63, 0x49, 0xa7, 0xc8,
-       0x67, 0x70, 0x58, 0x05, 0xa2, 0xd9, 0x4d, 0x9e, 0x32, 0xa1, 0x0b, 0xc8, 0xec, 0xc7, 0xf7, 0xc2,
-       0x9e, 0x31, 0x5c, 0x56, 0xfa, 0xe0, 0x2f, 0x0b, 0x9a, 0x3f, 0xe0, 0x3a, 0x2c, 0xf5, 0x62, 0xed,
-       0xd8, 0x4b, 0x63, 0x5b, 0x2f, 0x1b, 0x4b, 0xb0, 0x37, 0x97, 0x40, 0xbe, 0x84, 0xa3, 0xda, 0x59,
-       0xc4, 0x63, 0x99, 0xb1, 0x64, 0x13, 0xf1, 0xaa, 0x88, 0x97, 0xc6, 0x67, 0x90, 0x04, 0x3f, 0x83,
-       0xf7, 0x8d, 0xe4, 0x62, 0x44, 0x15, 0x23, 0xdf, 0x2e, 0xa2, 0x2c, 0xc1, 0x67, 0x5a, 0xd9, 0x8c,
-       0x1e, 0xb9, 0x8b, 0x5e, 0xf0, 0xda, 0x82, 0xd6, 0x8f, 0xb9, 0x9e, 0xe6, 0x9a, 0x9c, 0x42, 0xab,
-       0x9c, 0xb3, 0x09, 0x72, 0x67, 0x0d, 0x8c, 0x99, 0x3c, 0x83, 0x6e, 0x2c, 0x85, 0xce, 0xe4, 0xe4,
-       0x4d, 0x07, 0xfb, 0x81, 0xf1, 0xd9, 0xe9, 0x5c, 0x5f, 0x81, 0xd9, 0xd9, 0x06, 0xb3, 0x0f, 0xae,
-       0xcc, 0x12, 0x2e, 0xe8, 0xc4, 0x50, 0xa2, 0x12, 0x83, 0xdf, 0x2d, 0x80, 0x90, 0x69, 0x9e, 0xb1,
-       0x02, 0xe3, 0xdd, 0x5b, 0xa9, 0x8a, 0x6a, 0xbc, 0xb5, 0x28, 0x7b, 0x87, 0xa2, 0x9c, 0xd5, 0xa2,
-       0xfe, 0xb4, 0xc1, 0x1b, 0x98, 0xdb, 0x8d, 0x9c, 0x40, 0xbb, 0x9c, 0xf6, 0xa6, 0xbb, 0xd3, 0x2b,
-       0x4d, 0x83, 0x64, 0xd7, 0x1b, 0xe4, 0x3d, 0x80, 0xb9, 0x65, 0x81, 0x9a, 0xfb, 0x2d, 0x10, 0x19,
-       0x82, 0x5f, 0x6f, 0x33, 0x3e, 0x3b, 0x92, 0xfa, 0xd9, 0x80, 0xe7, 0x52, 0xa7, 0x7f, 0x54, 0xf7,
-       0xb0, 0x78, 0x51, 0x84, 0xf7, 0xab, 0xed, 0x5e, 0x7b, 0x69, 0x6c, 0x64, 0x92, 0xbb, 0x1f, 0x93,
-       0xbc, 0xb7, 0x32, 0x69, 0x79, 0x68, 0xed, 0xd5, 0xa1, 0xbd, 0x6e, 0x40, 0xf3, 0x7a, 0xca, 0x44,
-       0x42, 0xce, 0xa1, 0xab, 0xa6, 0x4c, 0xe8, 0x48, 0x22, 0x3f, 0x36, 0xcd, 0xed, 0x03, 0x74, 0x28,
-       0xf9, 0x53, 0x5e, 0x8d, 0xef, 0xba, 0x4d, 0x5b, 0xa6, 0xe2, 0xec, 0x39, 0x95, 0x7d, 0xce, 0xc4,
-       0x6d, 0x30, 0xb6, 0xf6, 0x82, 0xd1, 0x5d, 0x81, 0x71, 0xd4, 0xc2, 0x07, 0xf7, 0xc5, 0x7f, 0x01,
-       0x00, 0x00, 0xff, 0xff, 0x01, 0x5d, 0xef, 0x9a, 0x7c, 0x0b, 0x00, 0x00,
+       // 928 bytes of a gzipped FileDescriptorProto
+       0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xe3, 0x44,
+       0x14, 0x96, 0x63, 0x27, 0x76, 0x4e, 0x4a, 0x93, 0x4e, 0xab, 0x95, 0xb5, 0x5a, 0xa4, 0x62, 0x54,
+       0xba, 0x2b, 0xa4, 0xaa, 0x9b, 0x2e, 0x88, 0x0b, 0x6e, 0x0a, 0x05, 0x36, 0x17, 0xe5, 0xc7, 0x45,
+       0x7b, 0x6b, 0x4d, 0xec, 0xd9, 0x66, 0x44, 0xe2, 0x09, 0x33, 0xe3, 0x50, 0xf5, 0x31, 0xb8, 0xe5,
+       0x2d, 0xb8, 0x83, 0xeb, 0x7d, 0x1b, 0xee, 0x78, 0x02, 0xe4, 0xe3, 0xb1, 0xf3, 0xe7, 0xec, 0x26,
+       0xda, 0x72, 0xe7, 0xf3, 0xe3, 0xf3, 0xf3, 0x9d, 0xf3, 0xcd, 0x0c, 0x78, 0xc3, 0xf8, 0x6c, 0x2a,
+       0x85, 0x16, 0xa4, 0x31, 0x8c, 0x83, 0x6f, 0xc1, 0x79, 0x49, 0xd5, 0x88, 0xec, 0x43, 0x63, 0x76,
+       0xee, 0x5b, 0xc7, 0xd6, 0xd3, 0x56, 0xd8, 0x98, 0x9d, 0xa3, 0xfc, 0xdc, 0x6f, 0x18, 0xf9, 0x39,
+       0xca, 0x7d, 0xdf, 0x36, 0x72, 0x1f, 0xe5, 0x0b, 0xdf, 0x31, 0xf2, 0x45, 0xf0, 0x25, 0xb8, 0x3f,
+       0x4a, 0x71, 0x2b, 0xe9, 0x84, 0x7c, 0x08, 0x30, 0x9b, 0x44, 0x33, 0x26, 0x15, 0x17, 0x29, 0x86,
+       0x74, 0xc2, 0xf6, 0x6c, 0xf2, 0xaa, 0x50, 0x10, 0x02, 0x4e, 0x2c, 0x12, 0x86, 0xb1, 0xf7, 0x42,
+       0xfc, 0x0e, 0x06, 0xe0, 0x5e, 0x2a, 0xc5, 0xf4, 0xe0, 0xea, 0xbd, 0x0b, 0xb9, 0x86, 0x0e, 0x86,
+       0xba, 0x9c, 0x88, 0x2c, 0xd5, 0xe4, 0x13, 0xf0, 0x68, 0x2e, 0x46, 0x3c, 0xc1, 0xa0, 0x9d, 0x7e,
+       0xe7, 0x6c, 0x18, 0x9f, 0x99, 0x6c, 0xa1, 0x8b, 0xc6, 0x41, 0x42, 0x1e, 0x41, 0x8b, 0xe2, 0x1f,
+       0x98, 0xca, 0x09, 0x8d, 0x14, 0xfc, 0x61, 0x41, 0x17, 0x9d, 0xaf, 0xd8, 0x6b, 0x9e, 0x72, 0x9d,
+       0x77, 0xd0, 0x87, 0x1e, 0x7e, 0xd2, 0x71, 0x34, 0x1c, 0x8b, 0xf8, 0x97, 0x79, 0x6c, 0x2f, 0x8f,
+       0x9d, 0xe3, 0x19, 0xee, 0x1b, 0x8f, 0xaf, 0x72, 0x87, 0x41, 0x42, 0x3e, 0x87, 0x1e, 0x57, 0x2a,
+       0xa3, 0x69, 0xcc, 0xa2, 0x69, 0x01, 0x14, 0x66, 0x32, 0xf5, 0x18, 0xec, 0xc2, 0x6e, 0xe9, 0x54,
+       0x82, 0xf9, 0x04, 0x9c, 0x84, 0x6a, 0x8a, 0x0d, 0x2f, 0xc6, 0x47, 0x6d, 0x30, 0x86, 0xce, 0x2b,
+       0x3a, 0xce, 0xd8, 0x8d, 0xc8, 0x64, 0xcc, 0xc8, 0x63, 0xb0, 0x25, 0x7b, 0xbd, 0x56, 0x4b, 0xae,
+       0x24, 0x27, 0xd0, 0x9c, 0xe5, 0xae, 0x26, 0x6b, 0xb7, 0x42, 0xa1, 0x00, 0x2a, 0x2c, 0xac, 0xe4,
+       0x31, 0x78, 0x53, 0xa1, 0xb0, 0x4f, 0xcc, 0xe9, 0x84, 0x95, 0x1c, 0xfc, 0x0a, 0x3d, 0xcc, 0x76,
+       0xc5, 0x94, 0xe6, 0x29, 0x45, 0x2c, 0xfe, 0xe7, 0x94, 0xff, 0x34, 0xa0, 0x83, 0x10, 0xbe, 0x64,
+       0x34, 0x61, 0x92, 0xf8, 0xe0, 0x2e, 0x2f, 0x56, 0x29, 0x92, 0x53, 0xe8, 0x2a, 0x26, 0x39, 0x1d,
+       0xf3, 0x7b, 0x96, 0x44, 0x8a, 0xdf, 0x33, 0x33, 0xc9, 0xfd, 0xb9, 0xfa, 0x86, 0xdf, 0xb3, 0x7c,
+       0xd2, 0x23, 0xc6, 0x6f, 0x47, 0xda, 0x24, 0x33, 0x12, 0x79, 0x01, 0x07, 0x53, 0xc9, 0x66, 0x5c,
+       0x64, 0x6a, 0x3e, 0x56, 0x67, 0xa5, 0xaf, 0x6e, 0xe9, 0x52, 0xce, 0xf5, 0x09, 0x38, 0x8a, 0xb1,
+       0xc4, 0x6f, 0xae, 0xce, 0x27, 0xd7, 0x92, 0x8f, 0x60, 0x4f, 0xf3, 0x09, 0x53, 0x9a, 0x4e, 0xa6,
+       0xd1, 0x44, 0xf9, 0x2d, 0xcc, 0xd8, 0xa9, 0x74, 0xd7, 0x8a, 0x7c, 0x06, 0x07, 0x5a, 0xd2, 0x54,
+       0xd1, 0x38, 0x6f, 0x58, 0x45, 0x52, 0x08, 0xed, 0xbb, 0x2b, 0xd1, 0x7a, 0x8b, 0x2e, 0xa1, 0x10,
+       0x9a, 0x3c, 0x83, 0x0e, 0xae, 0xae, 0xf9, 0xc1, 0x5b, 0xf9, 0x01, 0x0a, 0x23, 0xba, 0x1e, 0x41,
+       0x33, 0x15, 0x69, 0xcc, 0xfc, 0x36, 0x66, 0x2f, 0x84, 0x9c, 0x86, 0x43, 0xae, 0x95, 0x0f, 0xa8,
+       0xc4, 0xef, 0xe0, 0x2f, 0x0b, 0xbc, 0x9f, 0xef, 0x1e, 0x0e, 0xea, 0x53, 0x00, 0xc9, 0x54, 0x36,
+       0xce, 0xd9, 0xa7, 0x7c, 0xfb, 0xd8, 0x5e, 0xaa, 0xb1, 0x5d, 0xd8, 0x06, 0x89, 0xaa, 0xb6, 0xdc,
+       0xa9, 0xdb, 0x72, 0xf2, 0x31, 0x78, 0xec, 0x4e, 0x47, 0x23, 0xaa, 0x46, 0x6b, 0x38, 0xbb, 0xec,
+       0x4e, 0xe7, 0x1f, 0xc1, 0xbf, 0x16, 0xd8, 0xd7, 0xd9, 0x1d, 0x79, 0x06, 0xae, 0x42, 0x36, 0x28,
+       0xdf, 0xc2, 0x84, 0xb8, 0x76, 0x0b, 0x2c, 0x09, 0x4b, 0x3b, 0x39, 0x01, 0xf7, 0x2d, 0x54, 0x2c,
+       0x6d, 0x4b, 0xe9, 0xed, 0x0d, 0xe9, 0xc9, 0x77, 0x70, 0xf4, 0x1b, 0xd7, 0x29, 0x53, 0x2a, 0x4a,
+       0xe6, 0xf4, 0x50, 0xbe, 0x83, 0x35, 0x1c, 0x55, 0x35, 0x2c, 0x70, 0x27, 0x3c, 0x34, 0x7f, 0x2c,
+       0xe8, 0x14, 0xf9, 0x14, 0x0e, 0xca, 0x40, 0x54, 0xde, 0x66, 0x13, 0x96, 0x6a, 0xe5, 0x37, 0x8f,
+       0xed, 0xa7, 0x7b, 0x61, 0xcf, 0x18, 0x2e, 0x4b, 0x7d, 0xf0, 0xb7, 0x05, 0xcd, 0xef, 0x71, 0x9c,
+       0x0b, 0xbd, 0x58, 0x5b, 0xf6, 0xd2, 0xd8, 0xd4, 0x4b, 0x6d, 0x09, 0x76, 0x7d, 0x09, 0xe4, 0x0b,
+       0x38, 0xac, 0x9c, 0xd3, 0x78, 0x24, 0x24, 0x4b, 0xea, 0x88, 0x53, 0x46, 0xbc, 0x34, 0x3e, 0x83,
+       0x24, 0xf8, 0x09, 0xbc, 0xaf, 0x05, 0x4f, 0x87, 0x54, 0x31, 0xf2, 0xcd, 0x3c, 0xca, 0x02, 0x7c,
+       0xa6, 0x95, 0x7a, 0xf4, 0xc8, 0x3a, 0x7a, 0xc1, 0x1b, 0x0b, 0x5a, 0x3f, 0x64, 0x7a, 0x9a, 0x69,
+       0x72, 0x0a, 0xad, 0x62, 0xce, 0x26, 0xc8, 0xda, 0x1a, 0x18, 0x33, 0x79, 0x01, 0xdd, 0x58, 0xa4,
+       0x5a, 0x8a, 0xf1, 0xdb, 0x0e, 0xe6, 0x7d, 0xe3, 0xb3, 0xd5, 0xb9, 0xbc, 0x04, 0xb3, 0xb3, 0x09,
+       0x66, 0x1f, 0x5c, 0x21, 0x13, 0x9e, 0xd2, 0x31, 0x6e, 0xb5, 0x13, 0x96, 0x62, 0xf0, 0xbb, 0x05,
+       0x10, 0x32, 0xcd, 0x25, 0xcb, 0x31, 0xde, 0xbe, 0x95, 0xb2, 0xa8, 0xc6, 0x3b, 0x8b, 0xb2, 0xb7,
+       0x28, 0xca, 0x59, 0x2e, 0xea, 0x4f, 0x1b, 0xbc, 0x81, 0xb9, 0x9d, 0xc8, 0x09, 0xb4, 0x8b, 0x69,
+       0xd7, 0xdd, 0x7d, 0x5e, 0x61, 0x1a, 0x24, 0xdb, 0xde, 0x00, 0x0f, 0x00, 0xe6, 0x86, 0x05, 0x6a,
+       0xee, 0xb6, 0x40, 0xe4, 0x1a, 0xfc, 0x6a, 0x9b, 0xf1, 0xd9, 0x90, 0x54, 0xd7, 0x3e, 0x1e, 0xde,
+       0x9d, 0xfe, 0x61, 0xd5, 0xc3, 0xfc, 0x45, 0x10, 0x3e, 0x2a, 0xb7, 0x7b, 0xe5, 0xa5, 0x50, 0xcb,
+       0x24, 0x77, 0x37, 0x26, 0x79, 0xef, 0x64, 0xd2, 0xe2, 0xd0, 0xda, 0xcb, 0x43, 0x7b, 0xd3, 0x80,
+       0xe6, 0xcd, 0x94, 0xa5, 0x09, 0x39, 0x87, 0xae, 0x9a, 0xb2, 0x54, 0x47, 0x02, 0xf9, 0x51, 0x37,
+       0xb7, 0x0f, 0xd0, 0xa1, 0xe0, 0x4f, 0x71, 0xb5, 0xbd, 0xef, 0x36, 0x6d, 0x98, 0x8a, 0xb3, 0xe3,
+       0x54, 0x76, 0x39, 0x13, 0x37, 0xc1, 0xd8, 0xda, 0x09, 0x46, 0x77, 0x09, 0xc6, 0x61, 0x0b, 0x1f,
+       0xcc, 0x17, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x0f, 0x45, 0xae, 0x3c, 0x0b, 0x00, 0x00,
 }
index b422551..9261066 100644 (file)
@@ -67,9 +67,7 @@ message TxHeader {
   uint64        serialized_size = 2;
   repeated Hash result_ids      = 3;
   Hash          data            = 4;
-  uint64        min_time_ms.    = 5;
-  uint64        max_time_ms.    = 6;
-  Hash          ext_hash        = 7;
+  Hash          ext_hash        = 5;
 }
 
 message Mux {
index c85148e..948d836 100644 (file)
@@ -5,7 +5,6 @@ package bctest
 import (
        "crypto/rand"
        "testing"
-       "time"
 
        "golang.org/x/crypto/sha3"
 
@@ -51,8 +50,6 @@ func NewIssuanceTx(tb testing.TB, initial bc.Hash, opts ...func(*legacy.Tx)) *le
 
        tx := legacy.NewTx(legacy.TxData{
                Version: 1,
-               MinTime: bc.Millis(time.Now().Add(-5 * time.Minute)),
-               MaxTime: bc.Millis(time.Now().Add(5 * time.Minute)),
                Inputs:  []*legacy.TxInput{txin},
                Outputs: []*legacy.TxOutput{
                        legacy.NewTxOutput(txin.AssetID(), 100, []byte{0xbe, 0xef}, nil),
diff --git a/protocol/bc/doc.go b/protocol/bc/doc.go
deleted file mode 100644 (file)
index cd47809..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-Package bc provides the fundamental blockchain data structures used in
-the Chain Protocol.
-
-This package is in transition from a set of "old" data structures
-(TxData, TxInput, TxOutput, etc.) to a new data model based on
-"entries," each with a specific type (such as spend, issuance, output,
-etc.), and each with its own distinct hash. The hash of a designated
-"header" entry serves as the hash of the entire transaction. The
-rationale for this change is that it is considerably more extensible,
-and it allows future scripting tools to traverse and access
-transaction data by making all components hash-addressable.
-
-Hashing and validation (of the old types) are redefined to mean
-"convert to the new data structures and hash/validate that."
-
-Soon the old structures will be retired entirely.
-
-These changes will be made in a compatible way; in particular, block
-and transaction hashes will not change.
-*/
-package bc
index 3b73685..525ac0f 100644 (file)
@@ -72,8 +72,7 @@ var byte32zero [32]byte
 // hash-serialization formats are not specified. It MUST NOT produce
 // errors in other cases.
 func mustWriteForHash(w io.Writer, c interface{}) {
-       err := writeForHash(w, c)
-       if err != nil {
+       if err := writeForHash(w, c); err != nil {
                panic(err)
        }
 }
@@ -129,8 +128,7 @@ func writeForHash(w io.Writer, c interface{}) error {
                return writeForHash(w, elem.Interface())
        case reflect.Slice:
                l := v.Len()
-               _, err := blockchain.WriteVarint31(w, uint64(l))
-               if err != nil {
+               if _, err := blockchain.WriteVarint31(w, uint64(l)); err != nil {
                        return errors.Wrapf(err, "writing slice (len %d) for hash", l)
                }
                for i := 0; i < l; i++ {
@@ -138,8 +136,7 @@ func writeForHash(w io.Writer, c interface{}) error {
                        if !c.CanInterface() {
                                return errInvalidValue
                        }
-                       err := writeForHash(w, c.Interface())
-                       if err != nil {
+                       if err := writeForHash(w, c.Interface()); err != nil {
                                return errors.Wrapf(err, "writing slice element %d for hash", i)
                        }
                }
@@ -152,8 +149,7 @@ func writeForHash(w io.Writer, c interface{}) error {
                        if !c.CanInterface() {
                                return errInvalidValue
                        }
-                       err := writeForHash(w, c.Interface())
-                       if err != nil {
+                       if err := writeForHash(w, c.Interface()); err != nil {
                                t := v.Type()
                                f := t.Field(i)
                                return errors.Wrapf(err, "writing struct field %d (%s.%s) for hash", i, t.Name(), f.Name)
index e97f094..053e6de 100644 (file)
@@ -3,7 +3,6 @@ package bc
 import (
        "reflect"
        "testing"
-       "time"
 )
 
 func BenchmarkEntryID(b *testing.B) {
@@ -11,7 +10,7 @@ func BenchmarkEntryID(b *testing.B) {
 
        entries := []Entry{
                NewIssuance(nil, &AssetAmount{}, &Hash{}, 0),
-               NewTxHeader(1, 1, nil, &Hash{}, uint64(time.Now().Unix()), uint64(time.Now().Unix())),
+               NewTxHeader(1, 1, nil, &Hash{}),
                m,
                NewNonce(&Program{Code: []byte{1}, VmVersion: 1}),
                NewOutput(&ValueSource{}, &Program{Code: []byte{1}, VmVersion: 1}, &Hash{}, 0),
index c2df967..ab3f8b0 100644 (file)
@@ -64,8 +64,7 @@ func (h *Hash) UnmarshalJSON(b []byte) error {
                return nil
        }
        var s string
-       err := json.Unmarshal(b, &s)
-       if err != nil {
+       if err := json.Unmarshal(b, &s); err != nil {
                return err
        }
        return h.UnmarshalText([]byte(s))
index ebce09c..6277610 100644 (file)
@@ -12,13 +12,12 @@ import (
        "github.com/bytom/errors"
 )
 
+// serflag variables, start with 1
 const (
-       SerBlockWitness      = 1
-       SerBlockTransactions = 2
-
-       SerBlockSigHash = 0
-       SerBlockHeader  = SerBlockWitness
-       SerBlockFull    = SerBlockWitness | SerBlockTransactions
+       _ = iota
+       SerBlockHeader
+       SerBlockTransactions
+       SerBlockFull
 )
 
 // Block describes a complete block, including its header
@@ -117,6 +116,7 @@ func (b *Block) readFrom(r *blockchain.Reader) error {
        return nil
 }
 
+// WriteTo will write block to input io.Writer
 func (b *Block) WriteTo(w io.Writer) (int64, error) {
        ew := errors.NewWriter(w)
        b.writeTo(ew, SerBlockFull)
index 7ad0bce..e7c2330 100644 (file)
@@ -7,6 +7,7 @@ import (
        "github.com/bytom/protocol/bc"
 )
 
+// BlockCommitment store the TransactionsMerkleRoot && AssetsMerkleRoot
 type BlockCommitment struct {
        // TransactionsMerkleRoot is the root hash of the Merkle binary hash
        // tree formed by the hashes of all transactions included in the
@@ -20,14 +21,10 @@ type BlockCommitment struct {
 }
 
 func (bc *BlockCommitment) readFrom(r *blockchain.Reader) error {
-       _, err := bc.TransactionsMerkleRoot.ReadFrom(r)
-       if err != nil {
-               return err
-       }
-       _, err = bc.AssetsMerkleRoot.ReadFrom(r)
-       if err != nil {
+       if _, err := bc.TransactionsMerkleRoot.ReadFrom(r); err != nil {
                return err
        }
+       _, err := bc.AssetsMerkleRoot.ReadFrom(r)
        return err
 }
 
index c0d5722..f69995a 100644 (file)
@@ -67,8 +67,7 @@ func (bh *BlockHeader) Hash() bc.Hash {
 func (bh *BlockHeader) MarshalText() ([]byte, error) {
        buf := bufpool.Get()
        defer bufpool.Put(buf)
-       _, err := bh.WriteTo(buf)
-       if err != nil {
+       if _, err := bh.WriteTo(buf); err != nil {
                return nil, err
        }
 
@@ -80,63 +79,48 @@ func (bh *BlockHeader) MarshalText() ([]byte, error) {
 // UnmarshalText fulfills the encoding.TextUnmarshaler interface.
 func (bh *BlockHeader) UnmarshalText(text []byte) error {
        decoded := make([]byte, hex.DecodedLen(len(text)))
-       _, err := hex.Decode(decoded, text)
-       if err != nil {
+       if _, err := hex.Decode(decoded, text); err != nil {
                return err
        }
-       _, err = bh.readFrom(blockchain.NewReader(decoded))
+       _, err := bh.readFrom(blockchain.NewReader(decoded))
        return err
 }
 
-func (bh *BlockHeader) readFrom(r *blockchain.Reader) (uint8, error) {
+func (bh *BlockHeader) readFrom(r *blockchain.Reader) (serflag uint8, err error) {
        var serflags [1]byte
        io.ReadFull(r, serflags[:])
-       switch serflags[0] {
-       case SerBlockSigHash, SerBlockHeader, SerBlockFull:
+       serflag = serflags[0]
+       switch serflag {
+       case SerBlockHeader, SerBlockFull:
        default:
                return 0, fmt.Errorf("unsupported serialization flags 0x%x", serflags)
        }
 
-       var err error
-
-       bh.Version, err = blockchain.ReadVarint63(r)
-       if err != nil {
+       if bh.Version, err = blockchain.ReadVarint63(r); err != nil {
                return 0, err
        }
-
-       bh.Height, err = blockchain.ReadVarint63(r)
-       if err != nil {
+       if bh.Height, err = blockchain.ReadVarint63(r); err != nil {
                return 0, err
        }
-
        if _, err = bh.PreviousBlockHash.ReadFrom(r); err != nil {
                return 0, err
        }
-
        if _, err = bh.Seed.ReadFrom(r); err != nil {
                return 0, err
        }
-
-       bh.TimestampMS, err = blockchain.ReadVarint63(r)
-       if err != nil {
+       if bh.TimestampMS, err = blockchain.ReadVarint63(r); err != nil {
                return 0, err
        }
-
        if _, err = blockchain.ReadExtensibleString(r, bh.BlockCommitment.readFrom); err != nil {
                return 0, err
        }
-
-       bh.Nonce, err = blockchain.ReadVarint63(r)
-       if err != nil {
+       if bh.Nonce, err = blockchain.ReadVarint63(r); err != nil {
                return 0, err
        }
-
-       bh.Bits, err = blockchain.ReadVarint63(r)
-       if err != nil {
+       if bh.Bits, err = blockchain.ReadVarint63(r); err != nil {
                return 0, err
        }
-
-       return serflags[0], nil
+       return
 }
 
 // WriteTo writes the block header to the input io.Writer
index 85d91cc..b971e47 100644 (file)
@@ -23,7 +23,7 @@ func TestMarshalBlock(t *testing.T) {
                Transactions: []*Tx{
                        NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(46),
+                               SerializedSize: uint64(43),
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1, nil, nil),
                                },
@@ -52,9 +52,6 @@ func TestMarshalBlock(t *testing.T) {
                "01" + // num transactions
                "07" + // tx 0, serialization flags
                "01" + // tx 0, tx version
-               "02" + // tx 0, common fields extensible length string
-               "00" + // tx 0, common fields mintime
-               "00" + // tx 0, common fields maxtime
                "00" + // tx 0, common witness extensible string length
                "00" + // tx 0, inputs count
                "01" + // tx 0, outputs count
@@ -165,7 +162,7 @@ func TestSmallBlock(t *testing.T) {
                "00" + // nonce
                "00" + // bits
                "01" + // num transactions
-               "070102000000000000") // transaction
+               "070100000000") // transaction
        want, _ := hex.DecodeString(wantHex)
        if !bytes.Equal(got, want) {
                t.Errorf("small block bytes = %x want %x", got, want)
index 4a05668..cc52409 100644 (file)
@@ -3,7 +3,7 @@ package legacy
 import "testing"
 
 func TestFuzzUnknownAssetVersion(t *testing.T) {
-       const rawTx = `07010700f785c1f1b72b0001f1b72b0001012b00089def834ab929327f3f479177e2d8c293f2f7fc4f251db8547896c0eeafb984261a73767178584c246400b50150935a092ffad7ec9fbac4f4486db6c3b8cd5b9f51cf697248584dde286a722000012b766baa20627e83fdad13dd98436fa7cbdd1412d50ef65528edb7e2ed8f2675b2a0b209235151ad696c00c0030040b984261ad6e71876ec4c2464012b766baa209d44ee5b6ebf6c408772ead7713f1a66b9de7655ff452513487be1fb10de7d985151ad696c00c02a7b2274657374223a225175657279546573742e7465737442616c616e636551756572792e74657374227d`
+       const rawTx = `07010001f1b72b0001012b00089def834ab929327f3f479177e2d8c293f2f7fc4f251db8547896c0eeafb984261a73767178584c246400b50150935a092ffad7ec9fbac4f4486db6c3b8cd5b9f51cf697248584dde286a722000012b766baa20627e83fdad13dd98436fa7cbdd1412d50ef65528edb7e2ed8f2675b2a0b209235151ad696c00c0030040b984261ad6e71876ec4c2464012b766baa209d44ee5b6ebf6c408772ead7713f1a66b9de7655ff452513487be1fb10de7d985151ad696c00c02a7b2274657374223a225175657279546573742e7465737442616c616e636551756572792e74657374227d`
 
        var want Tx
        err := want.UnmarshalText([]byte(rawTx))
index 325387a..0114d5c 100644 (file)
@@ -225,7 +225,7 @@ func mapTx(tx *TxData) (headerID bc.Hash, hdr *bc.TxHeader, entryMap map[bc.Hash
        }
 
        refdatahash := hashData(tx.ReferenceData)
-       h := bc.NewTxHeader(tx.Version, tx.SerializedSize, resultIDs, &refdatahash, tx.MinTime, tx.MaxTime)
+       h := bc.NewTxHeader(tx.Version, tx.SerializedSize, resultIDs, &refdatahash)
        headerID = addEntry(h)
 
        return headerID, h, entryMap
index da342cc..732d58c 100644 (file)
@@ -24,12 +24,6 @@ func TestMapTx(t *testing.T) {
        if header.SerializedSize != oldTx.SerializedSize {
                t.Errorf("header.SerializedSize is %d, expected %d", header.SerializedSize, oldTx.SerializedSize)
        }
-       if header.MinTimeMs != oldTx.MinTime {
-               t.Errorf("header.MinTimeMs is %d, expected %d", header.MinTimeMs, oldTx.MinTime)
-       }
-       if header.MaxTimeMs != oldTx.MaxTime {
-               t.Errorf("header.MaxTimeMs is %d, expected %d", header.MaxTimeMs, oldTx.MaxTime)
-       }
        if len(header.ResultIds) != len(oldOuts) {
                t.Errorf("header.ResultIds contains %d item(s), expected %d", len(header.ResultIds), len(oldOuts))
        }
index c3707f0..7ba0a3c 100644 (file)
@@ -27,22 +27,18 @@ func (oc *OutputCommitment) writeExtensibleString(w io.Writer, suffix []byte, as
 
 func (oc *OutputCommitment) writeContents(w io.Writer, suffix []byte, assetVersion uint64) (err error) {
        if assetVersion == 1 {
-               _, err = oc.AssetAmount.WriteTo(w)
-               if err != nil {
+               if _, err = oc.AssetAmount.WriteTo(w); err != nil {
                        return errors.Wrap(err, "writing asset amount")
                }
-               _, err = blockchain.WriteVarint63(w, oc.VMVersion)
-               if err != nil {
+               if _, err = blockchain.WriteVarint63(w, oc.VMVersion); err != nil {
                        return errors.Wrap(err, "writing vm version")
                }
-               _, err = blockchain.WriteVarstr31(w, oc.ControlProgram)
-               if err != nil {
+               if _, err = blockchain.WriteVarstr31(w, oc.ControlProgram); err != nil {
                        return errors.Wrap(err, "writing control program")
                }
        }
        if len(suffix) > 0 {
-               _, err = w.Write(suffix)
-               if err != nil {
+               if _, err = w.Write(suffix); err != nil {
                        return errors.Wrap(err, "writing suffix")
                }
        }
@@ -52,8 +48,7 @@ func (oc *OutputCommitment) writeContents(w io.Writer, suffix []byte, assetVersi
 func (oc *OutputCommitment) readFrom(r *blockchain.Reader, assetVersion uint64) (suffix []byte, err error) {
        return blockchain.ReadExtensibleString(r, func(r *blockchain.Reader) error {
                if assetVersion == 1 {
-                       err := oc.AssetAmount.ReadFrom(r)
-                       if err != nil {
+                       if err := oc.AssetAmount.ReadFrom(r); err != nil {
                                return errors.Wrap(err, "reading asset+amount")
                        }
                        oc.VMVersion, err = blockchain.ReadVarint63(r)
@@ -70,6 +65,7 @@ func (oc *OutputCommitment) readFrom(r *blockchain.Reader, assetVersion uint64)
        })
 }
 
+// Hash convert suffix && assetVersion to bc.Hash
 func (oc *OutputCommitment) Hash(suffix []byte, assetVersion uint64) (outputhash bc.Hash) {
        h := sha3pool.Get256()
        defer sha3pool.Put256(h)
index f14a24b..25ec6bf 100644 (file)
@@ -85,10 +85,6 @@ type TxData struct {
        Inputs         []*TxInput
        Outputs        []*TxOutput
 
-       // Common fields
-       MinTime uint64
-       MaxTime uint64
-
        // The unconsumed suffix of the common fields extensible string
        CommonFieldsSuffix []byte
 
@@ -115,14 +111,12 @@ func (tx *TxData) IsCoinbase() bool {
 
 func (tx *TxData) UnmarshalText(p []byte) error {
        b := make([]byte, hex.DecodedLen(len(p)))
-       _, err := hex.Decode(b, p)
-       if err != nil {
+       if _, err := hex.Decode(b, p); err != nil {
                return err
        }
 
        r := blockchain.NewReader(b)
-       err = tx.readFrom(r)
-       if err != nil {
+       if err := tx.readFrom(r); err != nil {
                return err
        }
        if trailing := r.Len(); trailing > 0 {
@@ -131,13 +125,12 @@ func (tx *TxData) UnmarshalText(p []byte) error {
        return nil
 }
 
-func (tx *TxData) readFrom(r *blockchain.Reader) error {
+func (tx *TxData) readFrom(r *blockchain.Reader) (err error) {
        var serflags [1]byte
-       _, err := io.ReadFull(r, serflags[:])
-       if err != nil {
+       if _, err = io.ReadFull(r, serflags[:]); err != nil {
                return errors.Wrap(err, "reading serialization flags")
        }
-       if err == nil && serflags[0] != serRequired {
+       if serflags[0] != serRequired {
                return fmt.Errorf("unsupported serflags %#x", serflags[0])
        }
 
@@ -148,19 +141,6 @@ func (tx *TxData) readFrom(r *blockchain.Reader) error {
 
        tx.SerializedSize = uint64(r.Len())
 
-       // Common fields
-       tx.CommonFieldsSuffix, err = blockchain.ReadExtensibleString(r, func(r *blockchain.Reader) error {
-               tx.MinTime, err = blockchain.ReadVarint63(r)
-               if err != nil {
-                       return errors.Wrap(err, "reading transaction mintime")
-               }
-               tx.MaxTime, err = blockchain.ReadVarint63(r)
-               return errors.Wrap(err, "reading transaction maxtime")
-       })
-       if err != nil {
-               return errors.Wrap(err, "reading transaction common fields")
-       }
-
        // Common witness
        tx.CommonWitnessSuffix, err = blockchain.ReadExtensibleString(r, tx.readCommonWitness)
        if err != nil {
@@ -173,8 +153,7 @@ func (tx *TxData) readFrom(r *blockchain.Reader) error {
        }
        for ; n > 0; n-- {
                ti := new(TxInput)
-               err = ti.readFrom(r)
-               if err != nil {
+               if err = ti.readFrom(r); err != nil {
                        return errors.Wrapf(err, "reading input %d", len(tx.Inputs))
                }
                tx.Inputs = append(tx.Inputs, ti)
@@ -186,8 +165,7 @@ func (tx *TxData) readFrom(r *blockchain.Reader) error {
        }
        for ; n > 0; n-- {
                to := new(TxOutput)
-               err = to.readFrom(r, tx.Version)
-               if err != nil {
+               if err = to.readFrom(r, tx.Version); err != nil {
                        return errors.Wrapf(err, "reading output %d", len(tx.Outputs))
                }
                tx.Outputs = append(tx.Outputs, to)
@@ -213,61 +191,40 @@ func (tx *TxData) MarshalText() ([]byte, error) {
 // WriteTo writes tx to w.
 func (tx *TxData) WriteTo(w io.Writer) (int64, error) {
        ew := errors.NewWriter(w)
-       err := tx.writeTo(ew, serRequired)
-       if err != nil {
+       if err := tx.writeTo(ew, serRequired); err != nil {
                return ew.Written(), ew.Err()
        }
        return ew.Written(), ew.Err()
 }
 
 func (tx *TxData) writeTo(w io.Writer, serflags byte) error {
-       _, err := w.Write([]byte{serflags})
-       if err != nil {
+       if _, err := w.Write([]byte{serflags}); err != nil {
                return errors.Wrap(err, "writing serialization flags")
        }
 
-       _, err = blockchain.WriteVarint63(w, tx.Version)
-       if err != nil {
+       if _, err := blockchain.WriteVarint63(w, tx.Version); err != nil {
                return errors.Wrap(err, "writing transaction version")
        }
 
-       // common fields
-       _, err = blockchain.WriteExtensibleString(w, tx.CommonFieldsSuffix, func(w io.Writer) error {
-               _, err := blockchain.WriteVarint63(w, tx.MinTime)
-               if err != nil {
-                       return errors.Wrap(err, "writing transaction min time")
-               }
-               _, err = blockchain.WriteVarint63(w, tx.MaxTime)
-               return errors.Wrap(err, "writing transaction max time")
-       })
-       if err != nil {
-               return errors.Wrap(err, "writing common fields")
-       }
-
        // common witness
-       _, err = blockchain.WriteExtensibleString(w, tx.CommonWitnessSuffix, tx.writeCommonWitness)
-       if err != nil {
+       if _, err := blockchain.WriteExtensibleString(w, tx.CommonWitnessSuffix, tx.writeCommonWitness); err != nil {
                return errors.Wrap(err, "writing common witness")
        }
 
-       _, err = blockchain.WriteVarint31(w, uint64(len(tx.Inputs)))
-       if err != nil {
+       if _, err := blockchain.WriteVarint31(w, uint64(len(tx.Inputs))); err != nil {
                return errors.Wrap(err, "writing tx input count")
        }
        for i, ti := range tx.Inputs {
-               err = ti.writeTo(w, serflags)
-               if err != nil {
+               if err := ti.writeTo(w, serflags); err != nil {
                        return errors.Wrapf(err, "writing tx input %d", i)
                }
        }
 
-       _, err = blockchain.WriteVarint31(w, uint64(len(tx.Outputs)))
-       if err != nil {
+       if _, err := blockchain.WriteVarint31(w, uint64(len(tx.Outputs))); err != nil {
                return errors.Wrap(err, "writing tx output count")
        }
        for i, to := range tx.Outputs {
-               err = to.writeTo(w, serflags)
-               if err != nil {
+               if err := to.writeTo(w, serflags); err != nil {
                        return errors.Wrapf(err, "writing tx output %d", i)
                }
        }
index 94b8c18..9f0aa53 100644 (file)
@@ -16,7 +16,7 @@ import (
 )
 
 func TestTransactionTrailingGarbage(t *testing.T) {
-       const validTxHex = `07010700d0929893b92b00000101270eac870dfde1e0feaa4fac6693dee38da2afe7f5cc83ce2b024f04a2400fd6e20a0104deadbeef027b7d0000`
+       const validTxHex = `070100000101270eac870dfde1e0feaa4fac6693dee38da2afe7f5cc83ce2b024f04a2400fd6e20a0104deadbeef027b7d0000`
 
        var validTx Tx
        err := validTx.UnmarshalText([]byte(validTxHex))
@@ -47,43 +47,33 @@ func TestTransaction(t *testing.T) {
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(7),
+                               SerializedSize: uint64(4),
                                Inputs:         nil,
                                Outputs:        nil,
-                               MinTime:        0,
-                               MaxTime:        0,
                                ReferenceData:  nil,
                        }),
                        hex: ("07" + // serflags
                                "01" + // transaction version
-                               "02" + // common fields extensible string length
-                               "00" + // common fields, mintime
-                               "00" + // common fields, maxtime
                                "00" + // common witness extensible string length
                                "00" + // inputs count
                                "00" + // outputs count
                                "00"), // reference data
-                       hash: mustDecodeHash("7ae6eef6b02fe61d35cc185405aec5f690ccb0ac291ecd6214445a1dff8fc9fd"),
+                       hash: mustDecodeHash("3629cd98d6707aab6055e125ea16be6a4e8e8c60aa195126ab7ee0cc246ab430"),
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(159),
+                               SerializedSize: uint64(156),
                                Inputs: []*TxInput{
                                        NewIssuanceInput([]byte{10, 9, 8}, 1000000000000, []byte("input"), initialBlockHash, issuanceScript, [][]byte{[]byte{1, 2, 3}}, nil),
                                },
                                Outputs: []*TxOutput{
                                        NewTxOutput(bc.AssetID{}, 1000000000000, []byte{1}, []byte("output")),
                                },
-                               MinTime:       0,
-                               MaxTime:       0,
                                ReferenceData: []byte("issuance"),
                        }),
                        hex: ("07" + // serflags
                                "01" + // transaction version
-                               "02" + // common fields extensible string length
-                               "00" + // common fields, mintime
-                               "00" + // common fields, maxtime
                                "00" + // common witness extensible string length
                                "01" + // inputs count
                                "01" + // input 0, asset version
@@ -113,12 +103,12 @@ func TestTransaction(t *testing.T) {
                                "066f7574707574" + // output 0, reference data
                                "00" + // output 0, output witness
                                "0869737375616e6365"), // reference data
-                       hash: mustDecodeHash("515774561625cfe07629e49d4cf938d641aeb62af58e1b3ae2c582fee41dc628"),
+                       hash: mustDecodeHash("191646bc995127b369a1459a58759368d8f1b95adfda87c9c858165a49f67659"),
                },
                {
                        tx: NewTx(TxData{
                                Version:        1,
-                               SerializedSize: uint64(235),
+                               SerializedSize: uint64(224),
                                Inputs: []*TxInput{
                                        NewSpendInput(nil, mustDecodeHash("dd385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292"), bc.AssetID{}, 1000000000000, 1, []byte{1}, bc.Hash{}, []byte("input")),
                                },
@@ -126,16 +116,10 @@ func TestTransaction(t *testing.T) {
                                        NewTxOutput(assetID, 600000000000, []byte{1}, nil),
                                        NewTxOutput(assetID, 400000000000, []byte{2}, nil),
                                },
-                               MinTime:       1492590000,
-                               MaxTime:       1492590591,
                                ReferenceData: []byte("distribution"),
                        }),
                        hex: ("07" + // serflags
                                "01" + // transaction version
-                               "0a" + // common fields extensible string length
-
-                               "b0bbdcc705" + // common fields, mintime
-                               "ffbfdcc705" + // common fields, maxtime
                                "00" + // common witness extensible string length
                                "01" + // inputs count
                                "01" + // input 0, asset version
@@ -170,47 +154,8 @@ func TestTransaction(t *testing.T) {
                                "00" + // output 1, reference data
                                "00" + // output 1, output witness
                                "0c646973747269627574696f6e"), // reference data
-                       hash: mustDecodeHash("c328ad4278045b4c50e8af7e7d0df198e7d9436d2b5de35df1339f13a1192331"),
+                       hash: mustDecodeHash("52611aef626501b815b0d80312fba172a5055b06458bbe32b980fd5e41ba8f46"),
                },
-
-               //07
-               //01
-               //0a
-               //b0bbdcc705
-               //ffbfdcc705
-               //00
-               //01
-               //01
-               //4b
-               //01
-               //dd385f6fe25d91d8c1bd0fa58951ad56b0c5229dcc01f61d9f9e8b9eb92d3292
-               //29
-               //0000000000000000000000000000000000000000000000000000000000000000
-               //80a094a58d1d
-               //01
-               //0101
-               //05696e707574
-               //01
-               //00
-               //02
-               //01
-               //29
-               //a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c1
-               //80e0a596bb11
-               //01
-               //0101
-               //00
-               //00
-               //01
-               //29
-               //a9b2b6c5394888ab5396f583ae484b8459486b14268e2bef1b637440335eb6c1
-               //80c0ee8ed20b
-               //01
-               //0102
-               //00
-               //00
-               //0c646973747269627574696f6e
-
        }
        for i, test := range cases {
                got := serialize(t, test.tx)
@@ -321,9 +266,6 @@ func TestIsCoinbase(t *testing.T) {
 func TestInvalidIssuance(t *testing.T) {
        hex := ("07" + // serflags
                "01" + // transaction version
-               "02" + // common fields extensible string length
-               "00" + // common fields, mintime
-               "00" + // common fields, maxtime
                "00" + // common witness extensible string length
                "01" + // inputs count
                "01" + // input 0, asset version
index 981929e..430e2d7 100644 (file)
@@ -15,11 +15,11 @@ func TestTxHashes(t *testing.T) {
        }{
                {
                        txdata: &TxData{},
-                       hash:   mustDecodeHash("e367a95b0f1dafdedd86f633456c81ef6bd4f2623f0890d56417f73a18a67297"),
+                       hash:   mustDecodeHash("02439cf4a8d801d10e84f5b3818226e38dac889dc626b7a1b5888b49510b38fe"),
                },
                {
                        txdata: sampleTx(),
-                       hash:   mustDecodeHash("9fad4f5024412d99d17508ef3cc66f81f1e09914a71b2641683acca87081c098"), // todo: verify this value,
+                       hash:   mustDecodeHash("360eab1b2563e85d9a3f290f3f2c0d99c622c89088f8c2e2003000fbee62cca0"), // todo: verify this value,
                },
        }
 
@@ -62,8 +62,6 @@ func sampleTx() *TxData {
                        NewTxOutput(assetID, 600000000000, []byte{1}, nil),
                        NewTxOutput(assetID, 400000000000, []byte{2}, nil),
                },
-               MinTime:       1492590000,
-               MaxTime:       1492590591,
                ReferenceData: []byte("distribution"),
        }
 }
index fbab4d6..9520d4a 100644 (file)
@@ -106,8 +106,7 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
                        return nil
                }
                var icType [1]byte
-               _, err = io.ReadFull(r, icType[:])
-               if err != nil {
+               if _, err = io.ReadFull(r, icType[:]); err != nil {
                        return errors.Wrap(err, "reading input commitment type")
                }
                switch icType[0] {
@@ -118,8 +117,7 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
                        if err != nil {
                                return err
                        }
-                       _, err = assetID.ReadFrom(r)
-                       if err != nil {
+                       if _, err = assetID.ReadFrom(r); err != nil {
                                return err
                        }
                        ii.Amount, err = blockchain.ReadVarint63(r)
@@ -156,8 +154,7 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
 
                if ii != nil {
                        // read IssuanceInput witness
-                       _, err = ii.InitialBlock.ReadFrom(r)
-                       if err != nil {
+                       if _, err = ii.InitialBlock.ReadFrom(r); err != nil {
                                return err
                        }
 
@@ -203,12 +200,11 @@ func (t *TxInput) readFrom(r *blockchain.Reader) (err error) {
 }
 
 func (t *TxInput) writeTo(w io.Writer, serflags uint8) error {
-       _, err := blockchain.WriteVarint63(w, t.AssetVersion)
-       if err != nil {
+       if _, err := blockchain.WriteVarint63(w, t.AssetVersion); err != nil {
                return errors.Wrap(err, "writing asset version")
        }
 
-       _, err = blockchain.WriteExtensibleString(w, t.CommitmentSuffix, func(w io.Writer) error {
+       _, err := blockchain.WriteExtensibleString(w, t.CommitmentSuffix, func(w io.Writer) error {
                return t.WriteInputCommitment(w, serflags)
        })
 
@@ -216,14 +212,12 @@ func (t *TxInput) writeTo(w io.Writer, serflags uint8) error {
                return errors.Wrap(err, "writing input commitment")
        }
 
-       _, err = blockchain.WriteVarstr31(w, t.ReferenceData)
-       if err != nil {
+       if _, err = blockchain.WriteVarstr31(w, t.ReferenceData); err != nil {
                return errors.Wrap(err, "writing reference data")
        }
 
        if serflags&SerWitness != 0 {
-               _, err = blockchain.WriteExtensibleString(w, t.WitnessSuffix, t.writeInputWitness)
-               if err != nil {
+               if _, err = blockchain.WriteExtensibleString(w, t.WitnessSuffix, t.writeInputWitness); err != nil {
                        return errors.Wrap(err, "writing input witness")
                }
        }
@@ -231,31 +225,27 @@ func (t *TxInput) writeTo(w io.Writer, serflags uint8) error {
        return nil
 }
 
-func (t *TxInput) WriteInputCommitment(w io.Writer, serflags uint8) error {
+func (t *TxInput) WriteInputCommitment(w io.Writer, serflags uint8) (err error) {
        if t.AssetVersion != 1 {
                return nil
        }
        switch inp := t.TypedInput.(type) {
        case *IssuanceInput:
-               _, err := w.Write([]byte{0}) // issuance type
-               if err != nil {
+               if _, err = w.Write([]byte{0}); err != nil {
                        return err
                }
-               _, err = blockchain.WriteVarstr31(w, inp.Nonce)
-               if err != nil {
+               if _, err = blockchain.WriteVarstr31(w, inp.Nonce); err != nil {
                        return err
                }
                assetID := t.AssetID()
-               _, err = assetID.WriteTo(w)
-               if err != nil {
+               if _, err = assetID.WriteTo(w); err != nil {
                        return err
                }
                _, err = blockchain.WriteVarint63(w, inp.Amount)
                return err
 
        case *SpendInput:
-               _, err := w.Write([]byte{1}) // spend type
-               if err != nil {
+               if _, err = w.Write([]byte{1}); err != nil {
                        return err
                }
                if serflags&SerPrevout != 0 {
index 4be9078..81d8ae1 100644 (file)
@@ -60,24 +60,20 @@ func (to *TxOutput) readFrom(r *blockchain.Reader, txVersion uint64) (err error)
 }
 
 func (to *TxOutput) writeTo(w io.Writer, serflags byte) error {
-       _, err := blockchain.WriteVarint63(w, to.AssetVersion)
-       if err != nil {
+       if _, err := blockchain.WriteVarint63(w, to.AssetVersion); err != nil {
                return errors.Wrap(err, "writing asset version")
        }
 
-       err = to.WriteCommitment(w)
-       if err != nil {
+       if err := to.WriteCommitment(w); err != nil {
                return errors.Wrap(err, "writing output commitment")
        }
 
-       err = writeRefData(w, to.ReferenceData, serflags)
-       if err != nil {
+       if err := writeRefData(w, to.ReferenceData, serflags); err != nil {
                return errors.Wrap(err, "writing reference data")
        }
 
        // write witness (empty in v1)
-       _, err = blockchain.WriteVarstr31(w, nil)
-       if err != nil {
+       if _, err := blockchain.WriteVarstr31(w, nil); err != nil {
                return errors.Wrap(err, "writing witness")
        }
        return nil
index 664f455..c14ffcd 100644 (file)
@@ -20,7 +20,7 @@ func TestMerkleRoot(t *testing.T) {
                                []byte("00000"),
                        },
                },
-               want: mustDecodeHash("77eae4222f60bfd74c07994d700161d0b831ed723037952b9c7ee98ed8766977"),
+               want: mustDecodeHash("c1b9e0b7f761e15b590834a01fe7a10e602d9ee6a4c674392a2b106242f29e8b"),
        }, {
                witnesses: [][][]byte{
                        [][]byte{
@@ -32,7 +32,7 @@ func TestMerkleRoot(t *testing.T) {
                                []byte("111111"),
                        },
                },
-               want: mustDecodeHash("526737fcca853f5ad352081c5a7341aca4ee05b09a002c8600e26a06df02aa3b"),
+               want: mustDecodeHash("1719bd4ff9fdf4de4b8e403a9302c30162e61bec1e688c21173c7c2aec4792bb"),
        }, {
                witnesses: [][][]byte{
                        [][]byte{
@@ -45,7 +45,7 @@ func TestMerkleRoot(t *testing.T) {
                                []byte("222222"),
                        },
                },
-               want: mustDecodeHash("526737fcca853f5ad352081c5a7341aca4ee05b09a002c8600e26a06df02aa3b"),
+               want: mustDecodeHash("1719bd4ff9fdf4de4b8e403a9302c30162e61bec1e688c21173c7c2aec4792bb"),
        }}
 
        for _, c := range cases {
index d893922..723ac0b 100644 (file)
@@ -12,19 +12,15 @@ func (h *TxHeader) writeForHash(w io.Writer) {
        mustWriteForHash(w, h.Version)
        mustWriteForHash(w, h.ResultIds)
        mustWriteForHash(w, h.Data)
-       mustWriteForHash(w, h.MinTimeMs)
-       mustWriteForHash(w, h.MaxTimeMs)
        mustWriteForHash(w, h.ExtHash)
 }
 
 // NewTxHeader creates an new TxHeader.
-func NewTxHeader(version, serializedSize uint64, resultIDs []*Hash, data *Hash, minTimeMS, maxTimeMS uint64) *TxHeader {
+func NewTxHeader(version, serializedSize uint64, resultIDs []*Hash, data *Hash) *TxHeader {
        return &TxHeader{
                Version:        version,
                SerializedSize: serializedSize,
                ResultIds:      resultIDs,
                Data:           data,
-               MinTimeMs:      minTimeMS,
-               MaxTimeMs:      maxTimeMS,
        }
 }
index 2e4c434..1e0cba6 100644 (file)
@@ -56,12 +56,11 @@ func walk(n *node, walkFn WalkFunc) error {
                return walkFn(n.Key())
        }
 
-       err := walk(n.children[0], walkFn)
-       if err != nil {
+       if err := walk(n.children[0], walkFn); err != nil {
                return err
        }
 
-       err = walk(n.children[1], walkFn)
+       err := walk(n.children[1], walkFn)
        return err
 }
 
@@ -104,7 +103,7 @@ func lookup(n *node, key []uint8) *node {
 // in t or to contain an element in t as a prefix.
 // If item itself is already in t, Insert does nothing
 // (and this is not an error).
-func (t *Tree) Insert(item []byte) error {
+func (t *Tree) Insert(item []byte) (err error) {
        key := bitKey(item)
 
        var hash bc.Hash
@@ -119,7 +118,6 @@ func (t *Tree) Insert(item []byte) error {
                return nil
        }
 
-       var err error
        t.root, err = insert(t.root, key, &hash)
        return err
 }
index b97d13f..53caedc 100644 (file)
@@ -59,10 +59,8 @@ func Empty() *Snapshot {
 
 // ApplyBlock updates s in place.
 func (s *Snapshot) ApplyBlock(block *bc.Block) error {
-       s.PruneNonces(block.TimestampMs)
        for i, tx := range block.Transactions {
-               err := s.ApplyTx(tx)
-               if err != nil {
+               if err := s.ApplyTx(tx); err != nil {
                        return errors.Wrapf(err, "applying block transaction %d", i)
                }
        }
@@ -78,7 +76,7 @@ func (s *Snapshot) ApplyTx(tx *bc.Tx) error {
                        return fmt.Errorf("conflicting nonce %x", n.Bytes())
                }
 
-               s.Nonces[n] = tx.TxHeader.MaxTimeMs
+               s.Nonces[n] = 0
        }
 
        // Remove spent outputs. Each output must be present.
index b90c3d5..e4b5f0e 100644 (file)
@@ -79,9 +79,7 @@ func TestCopySnapshot(t *testing.T) {
 func TestApplyBlock(t *testing.T) {
        // Setup a snapshot with a nonce with a known expiry.
        maxTime := bc.Millis(time.Now().Add(5 * time.Minute))
-       issuance := bctest.NewIssuanceTx(t, bc.EmptyStringHash, func(tx *legacy.Tx) {
-               tx.MaxTime = maxTime
-       })
+       issuance := bctest.NewIssuanceTx(t, bc.EmptyStringHash, func(tx *legacy.Tx) {})
        snap := Empty()
        err := snap.ApplyTx(legacy.MapTx(&issuance.TxData))
        if err != nil {
@@ -101,7 +99,7 @@ func TestApplyBlock(t *testing.T) {
        if err != nil {
                t.Fatal(err)
        }
-       if n := len(snap.Nonces); n != 0 {
-               t.Errorf("got %d nonces, want 0", n)
+       if n := len(snap.Nonces); n != 1 {
+               t.Errorf("got %d nonces, want 1", n)
        }
 }
index 588b1c0..2756134 100644 (file)
@@ -2,7 +2,6 @@ package protocol
 
 import (
        "github.com/bytom/errors"
-       "github.com/bytom/protocol/bc"
        "github.com/bytom/protocol/bc/legacy"
        "github.com/bytom/protocol/validation"
 )
@@ -15,9 +14,6 @@ var ErrBadTx = errors.New("invalid transaction")
 // performing full validation.
 func (c *Chain) ValidateTx(tx *legacy.Tx) error {
        newTx := tx.Tx
-       if err := c.checkIssuanceWindow(newTx); err != nil {
-               return err
-       }
        if ok := c.txPool.HaveTransaction(&newTx.ID); ok {
                return c.txPool.GetErrCache(&newTx.ID)
        }
@@ -37,17 +33,3 @@ func (c *Chain) ValidateTx(tx *legacy.Tx) error {
        c.txPool.AddTransaction(tx, block.BlockHeader.Height, fee)
        return errors.Sub(ErrBadTx, err)
 }
-
-func (c *Chain) checkIssuanceWindow(tx *bc.Tx) error {
-       if c.MaxIssuanceWindow == 0 {
-               return nil
-       }
-       for _, entryID := range tx.InputIDs {
-               if _, err := tx.Issuance(entryID); err == nil {
-                       if tx.MinTimeMs+bc.DurationMillis(c.MaxIssuanceWindow) < tx.MaxTimeMs {
-                               return errors.WithDetailf(ErrBadTx, "issuance input's time window is larger than the network maximum (%s)", c.MaxIssuanceWindow)
-                       }
-               }
-       }
-       return nil
-}
index 803598d..e857a36 100644 (file)
@@ -3,7 +3,6 @@ package protocol
 import (
        "fmt"
        "testing"
-       "time"
 
        "golang.org/x/crypto/sha3"
 
@@ -92,8 +91,6 @@ func issue(t testing.TB, asset *testAsset, dest *testDest, amount uint64) (*lega
                Outputs: []*legacy.TxOutput{
                        legacy.NewTxOutput(asset.AssetID, amount, destCP, nil),
                },
-               MinTime: bc.Millis(time.Now()),
-               MaxTime: bc.Millis(time.Now().Add(time.Hour)),
        })
        asset.sign(t, tx, 0)
 
index e0c854b..fe60ffd 100644 (file)
@@ -530,12 +530,6 @@ func ValidateBlock(b, prev *bc.Block, seedCaches *seed.SeedCaches) error {
                if b.Version == 1 && tx.Version != 1 {
                        return errors.WithDetailf(errTxVersion, "block version %d, transaction version %d", b.Version, tx.Version)
                }
-               if tx.MaxTimeMs > 0 && b.TimestampMs > tx.MaxTimeMs {
-                       return errors.WithDetailf(errUntimelyTransaction, "block timestamp %d, transaction time range %d-%d", b.TimestampMs, tx.MinTimeMs, tx.MaxTimeMs)
-               }
-               if tx.MinTimeMs > 0 && b.TimestampMs > 0 && b.TimestampMs < tx.MinTimeMs {
-                       return errors.WithDetailf(errUntimelyTransaction, "block timestamp %d, transaction time range %d-%d", b.TimestampMs, tx.MinTimeMs, tx.MaxTimeMs)
-               }
 
                txBTMValue, err := ValidateTx(tx, b)
                if err != nil {
index 6419778..d62bc82 100644 (file)
@@ -4,7 +4,6 @@ import (
        "fmt"
        "math"
        "testing"
-       "time"
 
        "github.com/bytom/consensus"
        "github.com/bytom/crypto/sha3pool"
@@ -547,17 +546,16 @@ func TestBlockHeaderValid(t *testing.T) {
 // affect the transaction that's built. The components of the
 // transaction are the fields of txFixture.
 type txFixture struct {
-       initialBlockID       bc.Hash
-       issuanceProg         bc.Program
-       issuanceArgs         [][]byte
-       assetDef             []byte
-       assetID              bc.AssetID
-       txVersion            uint64
-       txInputs             []*legacy.TxInput
-       txOutputs            []*legacy.TxOutput
-       txMinTime, txMaxTime uint64
-       txRefData            []byte
-       tx                   *legacy.TxData
+       initialBlockID bc.Hash
+       issuanceProg   bc.Program
+       issuanceArgs   [][]byte
+       assetDef       []byte
+       assetID        bc.AssetID
+       txVersion      uint64
+       txInputs       []*legacy.TxInput
+       txOutputs      []*legacy.TxOutput
+       txRefData      []byte
+       tx             *legacy.TxData
 }
 
 // Produces a sample transaction in a txFixture object (see above). A
@@ -646,12 +644,6 @@ func sample(tb testing.TB, in *txFixture) *txFixture {
                        legacy.NewTxOutput(result.assetID, 45, cp2, []byte{12}),
                }
        }
-       if result.txMinTime == 0 {
-               result.txMinTime = bc.Millis(time.Now().Add(-time.Minute))
-       }
-       if result.txMaxTime == 0 {
-               result.txMaxTime = bc.Millis(time.Now().Add(time.Minute))
-       }
        if len(result.txRefData) == 0 {
                result.txRefData = []byte{13}
        }
@@ -660,8 +652,6 @@ func sample(tb testing.TB, in *txFixture) *txFixture {
                Version:       result.txVersion,
                Inputs:        result.txInputs,
                Outputs:       result.txOutputs,
-               MinTime:       result.txMinTime,
-               MaxTime:       result.txMaxTime,
                ReferenceData: result.txRefData,
        }
 
index 580d061..fc14d15 100644 (file)
@@ -101,8 +101,6 @@ func NewTxVMContext(vs *validationState, entry bc.Entry, prog *bc.Program, args
                NumResults:    &numResults,
                AssetID:       assetID,
                Amount:        amount,
-               MinTimeMS:     &tx.MinTimeMs,
-               MaxTimeMS:     &tx.MaxTimeMs,
                EntryData:     entryData,
                TxData:        &txData,
                DestPos:       destPos,
index 2b34604..b31471b 100644 (file)
@@ -25,8 +25,6 @@ func TestCheckOutput(t *testing.T) {
                        legacy.NewTxOutput(bc.NewAssetID([32]byte{2}), 7, []byte("controlprog"), nil),
                        legacy.NewTxOutput(bc.NewAssetID([32]byte{2}), 7, []byte("controlprog"), []byte("outref")),
                },
-               MinTime: 0,
-               MaxTime: 20,
        })
 
        txCtx := &entryContext{
index 5574a11..12ddfae 100644 (file)
@@ -27,8 +27,6 @@ type Context struct {
        NumResults    *uint64
        AssetID       *[]byte
        Amount        *uint64
-       MinTimeMS     *uint64
-       MaxTimeMS     *uint64
        EntryData     *[]byte
        TxData        *[]byte
        DestPos       *uint64
index e694b1e..5712756 100644 (file)
@@ -1,7 +1,5 @@
 package vm
 
-import "math"
-
 func opCheckOutput(vm *virtualMachine) error {
        err := vm.applyCost(16)
        if err != nil {
@@ -86,35 +84,6 @@ func opProgram(vm *virtualMachine) error {
        return vm.push(vm.context.Code, true)
 }
 
-func opMinTime(vm *virtualMachine) error {
-       err := vm.applyCost(1)
-       if err != nil {
-               return err
-       }
-
-       if vm.context.MinTimeMS == nil {
-               return ErrContext
-       }
-       return vm.pushInt64(int64(*vm.context.MinTimeMS), true)
-}
-
-func opMaxTime(vm *virtualMachine) error {
-       err := vm.applyCost(1)
-       if err != nil {
-               return err
-       }
-
-       if vm.context.MaxTimeMS == nil {
-               return ErrContext
-       }
-       maxTimeMS := *vm.context.MaxTimeMS
-       if maxTimeMS == 0 || maxTimeMS > math.MaxInt64 {
-               maxTimeMS = uint64(math.MaxInt64)
-       }
-
-       return vm.pushInt64(int64(maxTimeMS), true)
-}
-
 func opEntryData(vm *virtualMachine) error {
        err := vm.applyCost(1)
        if err != nil {
index 283ff33..86493f9 100644 (file)
@@ -268,26 +268,6 @@ func TestIntrospectionOps(t *testing.T) {
                        dataStack:    [][]byte{[]byte("issueprog")},
                },
        }, {
-               op: OP_MINTIME,
-               startVM: &virtualMachine{
-                       context: &Context{MinTimeMS: new(uint64)},
-               },
-               wantVM: &virtualMachine{
-                       runLimit:     49991,
-                       deferredCost: 8,
-                       dataStack:    [][]byte{[]byte{}},
-               },
-       }, {
-               op: OP_MAXTIME,
-               startVM: &virtualMachine{
-                       context: &Context{MaxTimeMS: uint64ptr(20)},
-               },
-               wantVM: &virtualMachine{
-                       runLimit:     49990,
-                       deferredCost: 9,
-                       dataStack:    [][]byte{{20}},
-               },
-       }, {
                op: OP_TXDATA,
                startVM: &virtualMachine{
                        context: &Context{TxData: &txData},
@@ -331,8 +311,7 @@ func TestIntrospectionOps(t *testing.T) {
 
        txops := []Op{
                OP_CHECKOUTPUT, OP_ASSET, OP_AMOUNT, OP_PROGRAM,
-               OP_MINTIME, OP_MAXTIME, OP_TXDATA, OP_ENTRYDATA,
-               OP_INDEX, OP_OUTPUTID,
+               OP_TXDATA, OP_ENTRYDATA, OP_INDEX, OP_OUTPUTID,
        }
 
        for _, op := range txops {
index 2fe0f31..0e6ed6d 100644 (file)
@@ -204,8 +204,6 @@ const (
        OP_ASSET       Op = 0xc2
        OP_AMOUNT      Op = 0xc3
        OP_PROGRAM     Op = 0xc4
-       OP_MINTIME     Op = 0xc5
-       OP_MAXTIME     Op = 0xc6
        OP_TXDATA      Op = 0xc7
        OP_ENTRYDATA   Op = 0xc8
        OP_INDEX       Op = 0xc9
@@ -314,8 +312,6 @@ var (
                OP_ASSET:       {OP_ASSET, "ASSET", opAsset},
                OP_AMOUNT:      {OP_AMOUNT, "AMOUNT", opAmount},
                OP_PROGRAM:     {OP_PROGRAM, "PROGRAM", opProgram},
-               OP_MINTIME:     {OP_MINTIME, "MINTIME", opMinTime},
-               OP_MAXTIME:     {OP_MAXTIME, "MAXTIME", opMaxTime},
                OP_TXDATA:      {OP_TXDATA, "TXDATA", opTxData},
                OP_ENTRYDATA:   {OP_ENTRYDATA, "ENTRYDATA", opEntryData},
                OP_INDEX:       {OP_INDEX, "INDEX", opIndex},
index f9ac2c1..942a236 100644 (file)
@@ -406,11 +406,6 @@ func TestVerifyTxInputQuickCheck(t *testing.T) {
                        VMVersion: 1,
                        Code:      program,
                        Arguments: witnesses,
-
-                       // Leaving this out reduces coverage.
-                       // TODO(kr): figure out why and convert that
-                       // to a normal unit test.
-                       MaxTimeMS: new(uint64),
                }
                Verify(vctx, 10000)