OSDN Git Service

Merge pull request #41 from Bytom/dev
[bytom/vapor.git] / test / block_test_util.go
index e609d85..6915653 100644 (file)
@@ -1,16 +1,11 @@
 package test
 
 import (
-       "github.com/vapor/consensus"
-       "github.com/vapor/crypto"
-       "github.com/vapor/crypto/ed25519/chainkd"
-       "github.com/vapor/errors"
        "github.com/vapor/protocol"
        "github.com/vapor/protocol/bc"
        "github.com/vapor/protocol/bc/types"
        "github.com/vapor/protocol/validation"
        "github.com/vapor/protocol/vm"
-       "github.com/vapor/protocol/vm/vmutil"
 )
 
 // NewBlock create block according to the current status of chain
@@ -67,29 +62,9 @@ func NewBlock(chain *protocol.Chain, txs []*types.Tx, controlProgram []byte) (*t
        }
 
        b.TransactionStatusHash, err = types.TxStatusMerkleRoot(txStatus.VerifyStatus)
-       proof, err := generateProof(*b)
-       if err != nil {
-               return nil, err
-       }
-       b.Proof = proof
        return b, err
 }
 
-func generateProof(block types.Block) (types.Proof, error) {
-       var xPrv chainkd.XPrv
-       if consensus.ActiveNetParams.Signer == "" {
-               return types.Proof{}, errors.New("Signer is empty")
-       }
-       xPrv.UnmarshalText([]byte(consensus.ActiveNetParams.Signer))
-       sign := xPrv.Sign(block.BlockCommitment.TransactionsMerkleRoot.Bytes())
-       pubHash := crypto.Ripemd160(xPrv.XPub().PublicKey())
-       control, err := vmutil.P2WPKHProgram([]byte(pubHash))
-       if err != nil {
-               return types.Proof{}, err
-       }
-       return types.Proof{Sign: sign, ControlProgram: control}, nil
-}
-
 // ReplaceCoinbase replace the coinbase tx of block with coinbaseTx
 func ReplaceCoinbase(block *types.Block, coinbaseTx *types.Tx) (err error) {
        block.Transactions[0] = coinbaseTx