OSDN Git Service

Fix get consensus edge case (#147)
[bytom/vapor.git] / protocol / validation / block_test.go
index a6fcfeb..6f126c0 100644 (file)
@@ -21,15 +21,15 @@ func TestCheckBlockTime(t *testing.T) {
                err        error
        }{
                {
-                       blockTime:  1520000001,
+                       blockTime:  1520000500,
                        parentTime: []uint64{1520000000},
                        err:        nil,
                },
                {
                        desc:       "timestamp less than past median time (blocktest#1005)",
-                       blockTime:  1510000094,
-                       parentTime: []uint64{1520000000, 1510000099, 1510000098, 1510000097, 1510000096, 1510000095, 1510000094, 1510000093, 1510000092, 1510000091, 1510000090},
-                       err:        errBadTimestamp,
+                       blockTime:  1520005500,
+                       parentTime: []uint64{1520000000, 1520000500, 1520001000, 1520001500, 1520002000, 1520002500, 1520003000, 1520003500, 1520004000, 1520004500, 1520005000},
+                       err:        nil,
                },
                {
                        desc:       "timestamp greater than max limit (blocktest#1006)",
@@ -239,7 +239,7 @@ func TestValidateBlock(t *testing.T) {
                                                Version:        1,
                                                SerializedSize: 1,
                                                Inputs:         []*types.TxInput{types.NewCoinbaseInput(nil)},
-                                               Outputs:        []*types.TxOutput{types.NewIntraChainOutput(*consensus.BTMAssetID, 41250000000, cp)},
+                                               Outputs:        []*types.TxOutput{types.NewIntraChainOutput(*consensus.BTMAssetID, consensus.BlockSubsidy(0), cp)},
                                        }),
                                },
                        },
@@ -268,7 +268,7 @@ func TestValidateBlock(t *testing.T) {
                                                Version:        1,
                                                SerializedSize: 1,
                                                Inputs:         []*types.TxInput{types.NewCoinbaseInput(nil)},
-                                               Outputs:        []*types.TxOutput{types.NewIntraChainOutput(*consensus.BTMAssetID, 41250000000, cp)},
+                                               Outputs:        []*types.TxOutput{types.NewIntraChainOutput(*consensus.BTMAssetID, consensus.BlockSubsidy(0), cp)},
                                        }),
                                },
                        },
@@ -385,7 +385,7 @@ func TestSetTransactionStatus(t *testing.T) {
                        Height:                1,
                        Timestamp:             1523352601000,
                        PreviousBlockId:       &bc.Hash{V0: 0},
-                       TransactionsRoot:      &bc.Hash{V0: 10011341401654852692, V1: 8144266100226420640, V2: 18332298251154128538, V3: 7663092454615786384},
+                       TransactionsRoot:      &bc.Hash{V0: 12212572290317752069, V1: 8979003395977198825, V2: 3978010681554327084, V3: 12322462500143540195},
                        TransactionStatusHash: &bc.Hash{V0: 8682965660674182538, V1: 8424137560837623409, V2: 6979974817894224946, V3: 4673809519342015041},
                },
                Transactions: []*bc.Tx{
@@ -393,7 +393,7 @@ func TestSetTransactionStatus(t *testing.T) {
                                Version:        1,
                                SerializedSize: 1,
                                Inputs:         []*types.TxInput{types.NewCoinbaseInput(nil)},
-                               Outputs:        []*types.TxOutput{types.NewIntraChainOutput(*consensus.BTMAssetID, 41449998224, cp)},
+                               Outputs:        []*types.TxOutput{types.NewIntraChainOutput(*consensus.BTMAssetID, 199998224, cp)},
                        }),
                        types.MapTx(&types.TxData{
                                Version:        1,