* ethereum_get_cooinbase * change return type from CoinbaseAddress to Address * format
This commit is contained in:
parent
c7a1bad8e5
commit
819ee702e8
|
@ -453,4 +453,8 @@ impl<DB: Database> Client<DB> {
|
|||
pub async fn get_header(&self) -> Result<Header> {
|
||||
self.node.read().await.get_header()
|
||||
}
|
||||
|
||||
pub async fn get_coinbase(&self) -> Result<Address> {
|
||||
self.node.read().await.get_coinbase()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,6 +291,13 @@ impl Node {
|
|||
Ok(self.consensus.get_header().clone())
|
||||
}
|
||||
|
||||
pub fn get_coinbase(&self) -> Result<Address> {
|
||||
self.check_head_age()?;
|
||||
let payload = self.get_payload(BlockTag::Latest)?;
|
||||
let coinbase_address = Address::from_slice(&payload.fee_recipient);
|
||||
Ok(coinbase_address)
|
||||
}
|
||||
|
||||
pub fn get_last_checkpoint(&self) -> Option<Vec<u8>> {
|
||||
self.consensus.last_checkpoint.clone()
|
||||
}
|
||||
|
|
|
@ -112,6 +112,8 @@ trait EthRpc {
|
|||
slot: H256,
|
||||
block: BlockTag,
|
||||
) -> Result<String, Error>;
|
||||
#[method(name = "getCoinbase")]
|
||||
async fn get_coinbase(&self) -> Result<Address, Error>;
|
||||
}
|
||||
|
||||
#[rpc(client, server, namespace = "net")]
|
||||
|
@ -270,6 +272,12 @@ impl EthRpcServer for RpcInner {
|
|||
.await,
|
||||
)
|
||||
}
|
||||
|
||||
async fn get_coinbase(&self) -> Result<Address, Error> {
|
||||
let node = self.node.read().await;
|
||||
Ok(node.get_coinbase().unwrap())
|
||||
}
|
||||
|
||||
async fn get_logs(&self, filter: Filter) -> Result<Vec<Log>, Error> {
|
||||
let node = self.node.read().await;
|
||||
convert_err(node.get_logs(&filter).await)
|
||||
|
|
Loading…
Reference in New Issue