diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/oracle_contracts.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/vm/oracle_contracts.go b/core/vm/oracle_contracts.go index 1ebf3f1d4..cf060e9ac 100644 --- a/core/vm/oracle_contracts.go +++ b/core/vm/oracle_contracts.go @@ -488,6 +488,15 @@ func (s *GovernanceState) PutNodeOffsets(n *nodeInfo, offset *big.Int) error { return nil } +func (s *GovernanceState) GetNodeOwnerByID(id coreTypes.NodeID) (common.Address, error) { + offset := s.NodesOffsetByNodeKeyAddress(idToAddress(id)) + if offset.Cmp(big.NewInt(0)) < 0 { + return common.Address{}, errors.New("node not found") + } + node := s.Node(offset) + return node.Owner, nil +} + // struct Delegator { // address node; // address owner; |