Skip to content

Commit

Permalink
fix(nft): N of multisign register producer tx can not over 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Houshoupei84 authored and RainFallsSilent committed Jul 3, 2023
1 parent ba13324 commit 897307d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/transaction/registerproducertransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import (
"github.com/elastos/Elastos.ELA/vm"
)

// max n number for multisign producer register
const MaxMultisignN = 10

type RegisterProducerTransaction struct {
BaseTransaction
}
Expand Down Expand Up @@ -185,6 +188,13 @@ func (t *RegisterProducerTransaction) SpecialContextCheck() (elaerr.ELAError, bo
return elaerr.Simple(elaerr.ErrTxPayload,
errors.New("ProducerInfoMultiVersion tx program pk must equal with OwnerKey")), true
}
//check n
code := t.Programs()[0].Code
n := int(code[len(code)-2]) - crypto.PUSH1 + 1
if n > MaxMultisignN {
return elaerr.Simple(elaerr.ErrTxPayload,
errors.New("multisign n can not over 10")), true
}
}

height := t.parameters.BlockChain.GetHeight()
Expand Down

0 comments on commit 897307d

Please sign in to comment.