Commit fcefc56c authored by vipwzw's avatar vipwzw Committed by 33cn

update chain33

parent 6e73f767
......@@ -220,6 +220,7 @@ ForkResetTx0= 200000
ForkWithdraw= 200000
ForkExecRollback= 450000
ForkCheckBlockTime=1200000
ForkMultiSignAddress=1500000
ForkTxHeight= -1
ForkTxGroupPara= -1
ForkChainParamV2= -1
......
......@@ -20,7 +20,12 @@ var addressCache *lru.Cache
var checkAddressCache *lru.Cache
var multisignCache *lru.Cache
var multiCheckAddressCache *lru.Cache
var errVersion = errors.New("check version error")
// ErrCheckVersion :
var ErrCheckVersion = errors.New("check version error")
//ErrCheckChecksum :
var ErrCheckChecksum = errors.New("Address Checksum error")
//MaxExecNameLength 执行器名最大长度
const MaxExecNameLength = 100
......@@ -121,11 +126,11 @@ func checkAddress(ver byte, addr string) (e error) {
if len(dec) == 25 {
sh := common.Sha2Sum(dec[0:21])
if !bytes.Equal(sh[:4], dec[21:25]) {
e = errors.New("Address Checksum error")
e = ErrCheckChecksum
}
}
if dec[0] != ver {
e = errVersion
e = ErrCheckVersion
}
return e
}
......@@ -170,7 +175,7 @@ func NewAddrFromString(hs string) (a *Address, e error) {
if len(dec) == 25 {
sh := common.Sha2Sum(dec[0:21])
if !bytes.Equal(sh[:4], dec[21:25]) {
e = errors.New("Address Checksum error")
e = ErrCheckChecksum
} else {
a = new(Address)
a.Version = dec[0]
......
......@@ -42,7 +42,7 @@ func TestMultiSignAddress(t *testing.T) {
addr := MultiSignAddress(key.PubKey().Bytes())
assert.Equal(t, addr1, addr)
err := CheckAddress(addr)
assert.Equal(t, errVersion, err)
assert.Equal(t, ErrCheckVersion, err)
err = CheckMultiSignAddress(addr)
assert.Nil(t, err)
t.Log(addr)
......
......@@ -232,7 +232,12 @@ func CheckAddress(addr string, height int64) error {
if IsDriverAddress(addr, height) {
return nil
}
return address.CheckAddress(addr)
err := address.CheckAddress(addr)
if !types.IsFork(height, "ForkMultiSignAddress") && err == address.ErrCheckVersion {
return nil
}
return err
}
// Exec call the check exectx subclass, you can also do it without calling , implement your own checktx
......
......@@ -213,6 +213,7 @@ ForkResetTx0= 200000
ForkWithdraw= 200000
ForkExecRollback= 450000
ForkCheckBlockTime=1200000
ForkMultiSignAddress=1500000
ForkTxHeight= -1
ForkTxGroupPara= -1
ForkChainParamV2= -1
......
......@@ -205,6 +205,8 @@ func SetTestNetFork() {
systemFork.SetFork("chain33", "ForkTxHeight", 806578)
systemFork.SetFork("chain33", "ForkTxGroupPara", 806578)
systemFork.SetFork("chain33", "ForkCheckBlockTime", 1200000)
systemFork.SetFork("chain33", "ForkMultiSignAddress", 1500000)
}
func setLocalFork() {
......
......@@ -168,6 +168,7 @@ ForkExecRollback= 450000
ForkTxHeight= -1
ForkTxGroupPara= -1
ForkCheckBlockTime=1200000
ForkMultiSignAddress=1500000
[fork.sub.coins]
Enable=0
......
......@@ -186,6 +186,7 @@ ForkExecRollback= 450000
ForkTxHeight= -1
ForkTxGroupPara= -1
ForkCheckBlockTime=1200000
ForkMultiSignAddress=1500000
[fork.sub.coins]
Enable=0
......
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