• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revisionddd8ab9b26ec0cf64a0438aa7cdda21adb29a6f2 (tree)
Time2019-06-20 10:52:29
Authormars <mars@byto...>
Commitermars

Log Message

Cancel contract of btm inspection

Change Summary

Incremental Difference

--- a/protocol/validation/tx.go
+++ b/protocol/validation/tx.go
@@ -6,7 +6,6 @@ import (
66
77 "github.com/vapor/config"
88 "github.com/vapor/consensus"
9- "github.com/vapor/consensus/segwit"
109 "github.com/vapor/errors"
1110 "github.com/vapor/math/checked"
1211 "github.com/vapor/protocol/bc"
@@ -524,37 +523,12 @@ func checkValidDest(vs *validationState, vd *bc.ValueDestination) error {
524523 return nil
525524 }
526525
527-func checkStandardTx(tx *bc.Tx, blockHeight uint64) error {
526+func checkInputID(tx *bc.Tx, blockHeight uint64) error {
528527 for _, id := range tx.InputIDs {
529528 if blockHeight >= ruleAA && id.IsZero() {
530529 return ErrEmptyInputIDs
531530 }
532531 }
533-
534- for _, id := range tx.GasInputIDs {
535- spend, err := tx.Spend(id)
536- if err != nil {
537- continue
538- }
539-
540- code := []byte{}
541- outputEntry, err := tx.Entry(*spend.SpentOutputId)
542- if err != nil {
543- return err
544- }
545- switch output := outputEntry.(type) {
546- case *bc.IntraChainOutput:
547- code = output.ControlProgram.Code
548- case *bc.VoteOutput:
549- code = output.ControlProgram.Code
550- default:
551- return errors.Wrapf(bc.ErrEntryType, "entry %x has unexpected type %T", id.Bytes(), outputEntry)
552- }
553-
554- if !segwit.IsP2WScript(code) {
555- return ErrNotStandardTx
556- }
557- }
558532 return nil
559533 }
560534
@@ -582,7 +556,7 @@ func ValidateTx(tx *bc.Tx, block *bc.Block) (*GasState, error) {
582556 if err := checkTimeRange(tx, block); err != nil {
583557 return gasStatus, err
584558 }
585- if err := checkStandardTx(tx, block.Height); err != nil {
559+ if err := checkInputID(tx, block.Height); err != nil {
586560 return gasStatus, err
587561 }
588562
Show on old repository browser