Commit 0049c1ca authored by jiangpeng's avatar jiangpeng Committed by vipwzw

adapt with chain33 crypto

parent 63d102c0
...@@ -272,7 +272,7 @@ func (b *blsClient) checkCommitTx(txs []*types.Transaction) ([]*pt.ParacrossComm ...@@ -272,7 +272,7 @@ func (b *blsClient) checkCommitTx(txs []*types.Transaction) ([]*pt.ParacrossComm
var commits []*pt.ParacrossCommitAction var commits []*pt.ParacrossCommitAction
for _, tx := range txs { for _, tx := range txs {
//验签 //验签
if !tx.CheckSign() { if !tx.CheckSign(b.paraClient.GetCurrentHeight()) {
return nil, errors.Wrapf(types.ErrSign, "hash=%s", common.ToHex(tx.Hash())) return nil, errors.Wrapf(types.ErrSign, "hash=%s", common.ToHex(tx.Hash()))
} }
var act pt.ParacrossAction var act pt.ParacrossAction
......
...@@ -309,5 +309,5 @@ const Name = "bls" ...@@ -309,5 +309,5 @@ const Name = "bls"
const ID = 259 const ID = 259
func init() { func init() {
crypto.Register(Name, &Driver{}, crypto.WithOptionTypeID(ID)) crypto.Register(Name, &Driver{}, crypto.WithRegOptionTypeID(ID))
} }
...@@ -125,7 +125,7 @@ func TestChckSign(t *testing.T) { ...@@ -125,7 +125,7 @@ func TestChckSign(t *testing.T) {
} }
cfg.SetMinFee(0) cfg.SetMinFee(0)
assert.Equal(t, true, tx1.CheckSign()) assert.Equal(t, true, tx1.CheckSign(0))
} }
/** /**
...@@ -140,7 +140,7 @@ func TestChckSigns(t *testing.T) { ...@@ -140,7 +140,7 @@ func TestChckSigns(t *testing.T) {
cfg.SetMinFee(0) cfg.SetMinFee(0)
for i, tx := range txs { for i, tx := range txs {
if !tx.CheckSign() { if !tx.CheckSign(0) {
t.Error(fmt.Sprintf("error check tx[%d]", i+1)) t.Error(fmt.Sprintf("error check tx[%d]", i+1))
return return
} }
...@@ -178,7 +178,7 @@ func TestChckSignWithNoneAuth(t *testing.T) { ...@@ -178,7 +178,7 @@ func TestChckSignWithNoneAuth(t *testing.T) {
cfg.SetMinFee(0) cfg.SetMinFee(0)
tx14.Sign(types.SECP256K1, privKey) tx14.Sign(types.SECP256K1, privKey)
if !tx14.CheckSign() { if !tx14.CheckSign(0) {
t.Error("check signature failed") t.Error("check signature failed")
return return
} }
...@@ -203,7 +203,7 @@ func TestChckSignWithSm2(t *testing.T) { ...@@ -203,7 +203,7 @@ func TestChckSignWithSm2(t *testing.T) {
cfg.SetMinFee(0) cfg.SetMinFee(0)
tx15.Sign(ct.AuthSM2, privKeysm2) tx15.Sign(ct.AuthSM2, privKeysm2)
if !tx15.CheckSign() { if !tx15.CheckSign(0) {
t.Error("check signature failed") t.Error("check signature failed")
return return
} }
...@@ -227,7 +227,7 @@ func TestChckSignWithEcdsa(t *testing.T) { ...@@ -227,7 +227,7 @@ func TestChckSignWithEcdsa(t *testing.T) {
cfg.SetMinFee(0) cfg.SetMinFee(0)
tx16.Sign(ct.AuthECDSA, privKeyecdsa) tx16.Sign(ct.AuthECDSA, privKeyecdsa)
if !tx16.CheckSign() { if !tx16.CheckSign(0) {
t.Error("check signature failed") t.Error("check signature failed")
return return
} }
......
...@@ -21,7 +21,7 @@ import ( ...@@ -21,7 +21,7 @@ import (
) )
func init() { func init() {
crypto.Register(privacytypes.SignNameRing, &RingSignED25519{}, crypto.WithOptionTypeID(privacytypes.RingBaseonED25519)) crypto.Register(privacytypes.SignNameRing, &RingSignED25519{}, crypto.WithRegOptionTypeID(privacytypes.RingBaseonED25519))
} }
// RingSignature 环签名中对于crypto.Signature接口实现 // RingSignature 环签名中对于crypto.Signature接口实现
......
...@@ -166,7 +166,7 @@ func checkTxSignBySpecificAddr(tx *types.Transaction, addrs []string) error { ...@@ -166,7 +166,7 @@ func checkTxSignBySpecificAddr(tx *types.Transaction, addrs []string) error {
return x2eTy.ErrInvalidAdminAddress return x2eTy.ErrInvalidAdminAddress
} }
if !tx.CheckSign() { if !tx.CheckSign(0) {
return types.ErrSign return types.ErrSign
} }
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment