Merge PR #2800: Limit total number of signatures per transaction

* Limit total number of signatures per transaction
* Fail if limit is exceeded
* Loop over all sigs and count subkeys
* No need for a type switch, adopt early return
* Test rejection logic
* Mention sigs limit
This commit is contained in:
Alessio Treglia
2018-11-15 15:30:24 +01:00
committed by Christopher Goes
parent 7f68cee3d6
commit 7b7d45ddd2
5 changed files with 109 additions and 2 deletions
+6
View File
@@ -57,6 +57,7 @@ const (
CodeOutOfGas CodeType = 12
CodeMemoTooLarge CodeType = 13
CodeInsufficientFee CodeType = 14
CodeTooManySignatures CodeType = 15
// CodespaceRoot is a codespace for error codes in this file only.
// Notice that 0 is an "unset" codespace, which can be overridden with
@@ -103,6 +104,8 @@ func CodeToDefaultMsg(code CodeType) string {
return "memo too large"
case CodeInsufficientFee:
return "insufficient fee"
case CodeTooManySignatures:
return "maximum numer of signatures exceeded"
default:
return unknownCodeMsg(code)
}
@@ -155,6 +158,9 @@ func ErrMemoTooLarge(msg string) Error {
func ErrInsufficientFee(msg string) Error {
return newErrorWithRootCodespace(CodeInsufficientFee, msg)
}
func ErrTooManySignatures(msg string) Error {
return newErrorWithRootCodespace(CodeTooManySignatures, msg)
}
//----------------------------------------
// Error & sdkError