mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
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:
@@ -59,9 +59,9 @@ impl Network for LocalNetwork {
|
||||
}
|
||||
|
||||
async fn test_send<C: Coin + Clone>(coin: C, fee: C::Fee) {
|
||||
// Mine a block so there's a confirmed height
|
||||
// Mine blocks so there's a confirmed block
|
||||
coin.mine_block().await;
|
||||
let height = coin.get_height().await.unwrap();
|
||||
let latest = coin.get_latest_block_number().await.unwrap();
|
||||
|
||||
let mut keys = frost::tests::key_gen::<_, C::Curve>(&mut OsRng);
|
||||
let threshold = keys[&1].params().t();
|
||||
@@ -70,13 +70,13 @@ async fn test_send<C: Coin + Clone>(coin: C, fee: C::Fee) {
|
||||
let mut wallets = vec![];
|
||||
for i in 1 ..= threshold {
|
||||
let mut wallet = Wallet::new(MemCoinDb::new(), coin.clone());
|
||||
wallet.acknowledge_height(0, height);
|
||||
wallet.acknowledge_block(0, latest);
|
||||
wallet.add_keys(&WalletKeys::new(keys.remove(&i).unwrap(), 0));
|
||||
wallets.push(wallet);
|
||||
}
|
||||
|
||||
// Get the chain to a height where blocks have sufficient confirmations
|
||||
while (height + C::CONFIRMATIONS) > coin.get_height().await.unwrap() {
|
||||
// Get the chain to a length where blocks have sufficient confirmations
|
||||
while (latest + (C::CONFIRMATIONS - 1)) > coin.get_latest_block_number().await.unwrap() {
|
||||
coin.mine_block().await;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ async fn test_send<C: Coin + Clone>(coin: C, fee: C::Fee) {
|
||||
for (network, wallet) in networks.iter_mut().zip(wallets.iter_mut()) {
|
||||
wallet.poll().await.unwrap();
|
||||
|
||||
let height = coin.get_height().await.unwrap();
|
||||
wallet.acknowledge_height(1, height - 10);
|
||||
let latest = coin.get_latest_block_number().await.unwrap();
|
||||
wallet.acknowledge_block(1, latest - (C::CONFIRMATIONS - 1));
|
||||
let signable = wallet
|
||||
.prepare_sends(1, vec![(wallet.address(), 10000000000)], fee)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user