mirror of https://github.com/poanetwork/quorum.git
permission: node validation changed from string compare to enode id match in ValidateNodeForTxn
This commit is contained in:
parent
b53841d1d7
commit
01f4e9b131
|
@ -1,8 +1,8 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
@ -391,16 +391,26 @@ func ValidateNodeForTxn(enodeId string, from common.Address) bool {
|
||||||
if enodeId == "" {
|
if enodeId == "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
passedEnodeId, err := enode.ParseV4(enodeId)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
ac := AcctInfoMap.GetAccount(from)
|
ac := AcctInfoMap.GetAccount(from)
|
||||||
if ac == nil {
|
if ac == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
ultimateParent := OrgInfoMap.GetOrg(ac.OrgId).UltimateParent
|
ultimateParent := OrgInfoMap.GetOrg(ac.OrgId).UltimateParent
|
||||||
// scan through the node list and validate
|
// scan through the node list and validate
|
||||||
for _, n := range NodeInfoMap.GetNodeList() {
|
for _, n := range NodeInfoMap.GetNodeList() {
|
||||||
if OrgInfoMap.GetOrg(n.OrgId).UltimateParent == ultimateParent && strings.Contains(n.Url, enodeId) {
|
if OrgInfoMap.GetOrg(n.OrgId).UltimateParent == ultimateParent {
|
||||||
|
recEnodeId, _ := enode.ParseV4(n.Url)
|
||||||
|
if recEnodeId.ID() == passedEnodeId.ID() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue