當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Address.Str方法代碼示例

本文整理匯總了Golang中github.com/ethereum/go-ethereum/common.Address.Str方法的典型用法代碼示例。如果您正苦於以下問題:Golang Address.Str方法的具體用法?Golang Address.Str怎麽用?Golang Address.Str使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/ethereum/go-ethereum/common.Address的用法示例。


在下文中一共展示了Address.Str方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Refund

func (self *StateDB) Refund(address common.Address, gas *big.Int) {
	addr := address.Str()
	if self.refund[addr] == nil {
		self.refund[addr] = new(big.Int)
	}
	self.refund[addr].Add(self.refund[addr], gas)
}
開發者ID:CedarLogic,項目名稱:go-ethereum,代碼行數:7,代碼來源:statedb.go

示例2: GetStateObject

// GetStateObject returns the state object of the given account or nil if the
// account does not exist
func (self *LightState) GetStateObject(ctx context.Context, addr common.Address) (stateObject *StateObject, err error) {
	stateObject = self.stateObjects[addr.Str()]
	if stateObject != nil {
		if stateObject.deleted {
			stateObject = nil
		}
		return stateObject, nil
	}
	data, err := self.trie.Get(ctx, addr[:])
	if err != nil {
		return nil, err
	}
	if len(data) == 0 {
		return nil, nil
	}

	stateObject, err = DecodeObject(ctx, addr, self.odr, []byte(data))
	if err != nil {
		return nil, err
	}

	self.SetStateObject(stateObject)

	return stateObject, nil
}
開發者ID:Raskal8,項目名稱:go-ethereum,代碼行數:27,代碼來源:state.go

示例3: SetNonce

// SetNonce sets the new canonical nonce for the managed state
func (ms *ManagedState) SetNonce(addr common.Address, nonce uint64) {
	ms.mu.Lock()
	defer ms.mu.Unlock()

	so := ms.GetOrNewStateObject(addr)
	so.SetNonce(nonce)

	ms.accounts[addr.Str()] = newAccount(so)
}
開發者ID:ssonneborn22,項目名稱:go-ethereum,代碼行數:10,代碼來源:managed_state.go

示例4: newStateObject

// NewStateObject create a state object whether it exist in the trie or not
func (self *StateDB) newStateObject(addr common.Address) *StateObject {
	if glog.V(logger.Core) {
		glog.Infof("(+) %x\n", addr)
	}

	stateObject := NewStateObject(addr, self.db)
	self.stateObjects[addr.Str()] = stateObject

	return stateObject
}
開發者ID:CedarLogic,項目名稱:go-ethereum,代碼行數:11,代碼來源:statedb.go

示例5: newStateObject

// newStateObject creates a state object whether it exists in the state or not
func (self *LightState) newStateObject(addr common.Address) *StateObject {
	if glog.V(logger.Core) {
		glog.Infof("(+) %x\n", addr)
	}

	stateObject := NewStateObject(addr, self.odr)
	stateObject.SetNonce(StartingNonce)
	self.stateObjects[addr.Str()] = stateObject

	return stateObject
}
開發者ID:Raskal8,項目名稱:go-ethereum,代碼行數:12,代碼來源:state.go

示例6: getAccount

// populate the managed state
func (ms *ManagedState) getAccount(addr common.Address) *account {
	straddr := addr.Str()
	if account, ok := ms.accounts[straddr]; !ok {
		so := ms.GetOrNewStateObject(addr)
		ms.accounts[straddr] = newAccount(so)
	} else {
		// Always make sure the state account nonce isn't actually higher
		// than the tracked one.
		so := ms.StateDB.GetStateObject(addr)
		if so != nil && uint64(len(account.nonces))+account.nstart < so.nonce {
			ms.accounts[straddr] = newAccount(so)
		}

	}

	return ms.accounts[straddr]
}
開發者ID:ssonneborn22,項目名稱:go-ethereum,代碼行數:18,代碼來源:managed_state.go

示例7: GetStateObject

// Retrieve a state object given my the address. Nil if not found
func (self *StateDB) GetStateObject(addr common.Address) *StateObject {
	//addr = common.Address(addr)

	stateObject := self.stateObjects[addr.Str()]
	if stateObject != nil {
		return stateObject
	}

	data := self.trie.Get(addr[:])
	if len(data) == 0 {
		return nil
	}

	stateObject = NewStateObjectFromBytes(addr, []byte(data), self.db)
	self.SetStateObject(stateObject)

	return stateObject
}
開發者ID:CedarLogic,項目名稱:go-ethereum,代碼行數:19,代碼來源:statedb.go

示例8: GetStateObject

// Retrieve a state object given my the address. Nil if not found
func (self *StateDB) GetStateObject(addr common.Address) (stateObject *StateObject) {
	stateObject = self.stateObjects[addr.Str()]
	if stateObject != nil {
		if stateObject.deleted {
			stateObject = nil
		}

		return stateObject
	}

	data := self.trie.Get(addr[:])
	if len(data) == 0 {
		return nil
	}

	stateObject = NewStateObjectFromBytes(addr, []byte(data), self.db)
	self.SetStateObject(stateObject)

	return stateObject
}
開發者ID:NikonMcFly,項目名稱:go-ethereum,代碼行數:21,代碼來源:statedb.go

示例9: GetStateObject

// Retrieve a state object given my the address. Nil if not found
func (self *StateDB) GetStateObject(addr common.Address) (stateObject *StateObject) {
	stateObject = self.stateObjects[addr.Str()]
	if stateObject != nil {
		if stateObject.deleted {
			stateObject = nil
		}

		return stateObject
	}

	data := self.trie.Get(addr[:])
	if len(data) == 0 {
		return nil
	}
	stateObject, err := DecodeObject(addr, self.db, data)
	if err != nil {
		glog.Errorf("can't decode object at %x: %v", addr[:], err)
		return nil
	}
	self.SetStateObject(stateObject)
	return stateObject
}
開發者ID:Xiaoyang-Zhu,項目名稱:go-ethereum,代碼行數:23,代碼來源:statedb.go

示例10: hasAccount

func (ms *ManagedState) hasAccount(addr common.Address) bool {
	_, ok := ms.accounts[addr.Str()]
	return ok
}
開發者ID:ssonneborn22,項目名稱:go-ethereum,代碼行數:4,代碼來源:managed_state.go


注:本文中的github.com/ethereum/go-ethereum/common.Address.Str方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。