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
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/p2p/enode"
|
||||
"math/big"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
|
@ -391,16 +391,26 @@ func ValidateNodeForTxn(enodeId string, from common.Address) bool {
|
|||
if enodeId == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
passedEnodeId, err := enode.ParseV4(enodeId)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
ac := AcctInfoMap.GetAccount(from)
|
||||
if ac == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
ultimateParent := OrgInfoMap.GetOrg(ac.OrgId).UltimateParent
|
||||
// scan through the node list and validate
|
||||
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 false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue