diff --git a/docs/gift-codes/gift-code/build_gift_code.md b/docs/gift-codes/gift-code/build_gift_code.md index 96449c1a1..98b4fb2d0 100644 --- a/docs/gift-codes/gift-code/build_gift_code.md +++ b/docs/gift-codes/gift-code/build_gift_code.md @@ -15,7 +15,7 @@ description: Build a gift code in a tx_proposal that you can fund and submit to | :--- | :--- | :--- | | `input_txo_ids` | The specific TXOs to use as inputs to this transaction. | TXO IDs \(obtain from `get_all_txos_for_account`\) | | `fee` | The fee amount to submit with this transaction. | If not provided, uses `MINIMUM_FEE` = .01 MOB. | -| `tombstone_block` | The block after which this transaction expires. | If not provided, uses `cur_height` + 50. | +| `tombstone_block` | The block after which this transaction expires. | If not provided, uses `cur_height` + 10. | | `max_spendable_value` | The maximum amount for an input TXO selected for this transaction. | | | `memo` | Memo for whoever claims the gift code. | | diff --git a/docs/transactions/transaction/build_and_submit_transaction.md b/docs/transactions/transaction/build_and_submit_transaction.md index 9e7009913..ed2542161 100644 --- a/docs/transactions/transaction/build_and_submit_transaction.md +++ b/docs/transactions/transaction/build_and_submit_transaction.md @@ -19,7 +19,7 @@ description: >- | `addresses_and_values` | An array of public addresses and value tuples | addresses are b58-encoded public addresses, value is in pmob | | `input_txo_ids` | Specific TXOs to use as inputs to this transaction | TXO IDs \(obtain from `get_all_txos_for_account`\) | | `fee` | The fee amount to submit with this transaction | If not provided, uses `MINIMUM_FEE` = .01 MOB | -| `tombstone_block` | The block after which this transaction expires | If not provided, uses `cur_height` + 50 | +| `tombstone_block` | The block after which this transaction expires | If not provided, uses `cur_height` + 10 | | `max_spendable_value` | The maximum amount for an input TXO selected for this transaction | | | `comment` | Comment to annotate this transaction in the transaction log | | diff --git a/docs/transactions/transaction/build_transaction.md b/docs/transactions/transaction/build_transaction.md index 147112153..b6be7aa54 100644 --- a/docs/transactions/transaction/build_transaction.md +++ b/docs/transactions/transaction/build_transaction.md @@ -19,7 +19,7 @@ description: >- | `addresses_and_values` | An array of public addresses and value tuples | addresses are b58-encoded public addresses, value is in pmob | | `input_txo_ids` | Specific TXOs to use as inputs to this transaction | TXO IDs \(obtain from `get_all_txos_for_account`\) | | `fee` | The fee amount to submit with this transaction | If not provided, uses `MINIMUM_FEE` = .01 MOB | -| `tombstone_block` | The block after which this transaction expires | If not provided, uses `cur_height` + 50 | +| `tombstone_block` | The block after which this transaction expires | If not provided, uses `cur_height` + 10 | | `max_spendable_value` | The maximum amount for an input TXO selected for this transaction | | | `log_tx_proposal` | Whether or not to log the tx proposal on build | If not provided, is false | diff --git a/full-service/src/json_rpc/e2e.rs b/full-service/src/json_rpc/e2e.rs index c6eea463d..a83cb472e 100644 --- a/full-service/src/json_rpc/e2e.rs +++ b/full-service/src/json_rpc/e2e.rs @@ -734,10 +734,10 @@ mod e2e { .unwrap(); assert_eq!(outlay_confirmation_numbers.len(), 1); - // Tombstone block = ledger height (12 to start + 2 new blocks + 50 default + // Tombstone block = ledger height (12 to start + 2 new blocks + 10 default // tombstone) let prefix_tombstone = tx_prefix.get("tombstone_block").unwrap(); - assert_eq!(prefix_tombstone, "64"); + assert_eq!(prefix_tombstone, "24"); let json_tx_proposal: json_rpc::tx_proposal::TxProposal = serde_json::from_value(tx_proposal.clone()).unwrap(); @@ -939,10 +939,10 @@ mod e2e { .unwrap(); assert_eq!(outlay_confirmation_numbers.len(), 1); - // Tombstone block = ledger height (12 to start + 2 new blocks + 50 default + // Tombstone block = ledger height (12 to start + 2 new blocks + 10 default // tombstone) let prefix_tombstone = tx_prefix.get("tombstone_block").unwrap(); - assert_eq!(prefix_tombstone, "64"); + assert_eq!(prefix_tombstone, "24"); // Get current balance assert_eq!(ledger_db.num_blocks().unwrap(), 14); diff --git a/full-service/src/service/gift_code.rs b/full-service/src/service/gift_code.rs index f270e5d78..fc30f576b 100644 --- a/full-service/src/service/gift_code.rs +++ b/full-service/src/service/gift_code.rs @@ -19,6 +19,7 @@ use crate::{ account::AccountServiceError, address::{AddressService, AddressServiceError}, transaction::{TransactionService, TransactionServiceError}, + transaction_builder::DEFAULT_NEW_TX_BLOCK_ATTEMPTS, WalletService, }, util::b58::{ @@ -641,8 +642,8 @@ where transaction_builder.set_fee(Mob::MINIMUM_FEE)?; let num_blocks_in_ledger = self.ledger_db.num_blocks()?; - transaction_builder.set_tombstone_block(num_blocks_in_ledger + 50); - + transaction_builder + .set_tombstone_block(num_blocks_in_ledger + DEFAULT_NEW_TX_BLOCK_ATTEMPTS); let tx = transaction_builder.build(&mut rng)?; let responder_ids = self.peer_manager.responder_ids(); diff --git a/full-service/src/service/receipt.rs b/full-service/src/service/receipt.rs index c32d62d79..8525f2220 100644 --- a/full-service/src/service/receipt.rs +++ b/full-service/src/service/receipt.rs @@ -449,7 +449,7 @@ mod tests { let txo_pubkey = mc_util_serial::decode(&txos[0].public_key).expect("Could not decode pubkey"); assert_eq!(receipt.public_key, txo_pubkey); - assert_eq!(receipt.tombstone_block, 63); // Ledger seeded with 12 blocks at tx construction, then one appended + 50 + assert_eq!(receipt.tombstone_block, 23); // Ledger seeded with 12 blocks at tx construction, then one appended + 10 let txo: TxOut = mc_util_serial::decode(&txos[0].txo).expect("Could not decode txo"); assert_eq!(receipt.amount, txo.amount); assert_eq!(receipt.confirmation, confirmations[0].confirmation); diff --git a/full-service/src/service/transaction_builder.rs b/full-service/src/service/transaction_builder.rs index 731bda2c7..3a6f7a7d5 100644 --- a/full-service/src/service/transaction_builder.rs +++ b/full-service/src/service/transaction_builder.rs @@ -47,7 +47,7 @@ use std::{convert::TryFrom, str::FromStr, sync::Arc}; /// Default number of blocks used for calculating transaction tombstone block /// number. // TODO support for making this configurable -pub const DEFAULT_NEW_TX_BLOCK_ATTEMPTS: u64 = 50; +pub const DEFAULT_NEW_TX_BLOCK_ATTEMPTS: u64 = 10; /// A builder of transactions constructed from this wallet. pub struct WalletTransactionBuilder { @@ -823,7 +823,7 @@ mod tests { // Not setting the tombstone results in tombstone = 0. This is an acceptable // value, let proposal = builder.build().unwrap(); - assert_eq!(proposal.tx.prefix.tombstone_block, 63); + assert_eq!(proposal.tx.prefix.tombstone_block, 23); // Build a transaction and explicitly set tombstone let (recipient, mut builder) =