Fix BLS message ChainLength add more detail to ValidForBlockInclusion

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-10-13 19:20:11 +02:00
parent 87cd8c6725
commit 8987defb9d
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
2 changed files with 9 additions and 2 deletions

View File

@ -195,7 +195,7 @@ func (m *Message) ValidForBlockInclusion(minGas int64) error {
// since prices might vary with time, this is technically semantic validation
if m.GasLimit < minGas {
return xerrors.New("'GasLimit' field cannot be less than the cost of storing a message on chain")
return xerrors.Errorf("'GasLimit' field cannot be less than the cost of storing a message on chain %d < %d", m.GasLimit, minGas)
}
return nil

View File

@ -78,7 +78,14 @@ func (sm *SignedMessage) MarshalJSON() ([]byte, error) {
}
func (sm *SignedMessage) ChainLength() int {
ser, err := sm.Serialize()
var ser []byte
var err error
if sm.Signature.Type == crypto.SigTypeBLS {
// BLS chain message length doesn't include signature
ser, err = sm.Message.Serialize()
} else {
ser, err = sm.Serialize()
}
if err != nil {
panic(err)
}