Remove height as a term

Unbeknowst to me, height doesn't have a universal definition of the 
chain length.

Bitcoin defines height as the block number, with getblockcount existing 
for the chain length.

Ethereum uses the unambiguous term "block number".

Monero defines height as both the block number and the chain length.

Instead of arguing about who's right, it's agreed it referring to both 
isn't productive. While we could provide our own definition, taking a 
side, moving to the unambiguous block number prevents future hiccups.

height is now only a term in the Monero code, where it takes its 
Monero-specific definition, as documented in the processor.
This commit is contained in:
Luke Parker
2022-10-15 21:39:06 -04:00
parent a245ee28c1
commit 514563cef0
5 changed files with 82 additions and 84 deletions

View File

@@ -47,8 +47,8 @@ pub trait Coin {
// Doesn't have to take self, enables some level of caching which is pleasant
fn address(&self, key: <Self::Curve as Curve>::G) -> Self::Address;
async fn get_height(&self) -> Result<usize, CoinError>;
async fn get_block(&self, height: usize) -> Result<Self::Block, CoinError>;
async fn get_latest_block_number(&self) -> Result<usize, CoinError>;
async fn get_block(&self, number: usize) -> Result<Self::Block, CoinError>;
async fn get_outputs(
&self,
block: &Self::Block,
@@ -56,13 +56,13 @@ pub trait Coin {
) -> Result<Vec<Self::Output>, CoinError>;
// TODO: Remove
async fn is_confirmed(&self, tx: &[u8], height: usize) -> Result<bool, CoinError>;
async fn is_confirmed(&self, tx: &[u8]) -> Result<bool, CoinError>;
async fn prepare_send(
&self,
keys: FrostKeys<Self::Curve>,
transcript: RecommendedTranscript,
height: usize,
block_number: usize,
inputs: Vec<Self::Output>,
payments: &[(Self::Address, u64)],
fee: Self::Fee,