diff --git a/API.md b/API.md index a672bb282..a106ab220 100644 --- a/API.md +++ b/API.md @@ -1320,7 +1320,7 @@ curl -s localhost:9090/wallet \ | :------------- | :----------------------- | :------------------------ | | `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` + 100 | +| `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 | | Note, as the tx_proposal json object is quite large, you may wish to write the result to a file for use in the submit_transaction call, such as: diff --git a/full-service/src/json_rpc/e2e.rs b/full-service/src/json_rpc/e2e.rs index f297d6ed3..ef0e9541d 100644 --- a/full-service/src/json_rpc/e2e.rs +++ b/full-service/src/json_rpc/e2e.rs @@ -722,7 +722,7 @@ mod e2e { // Tombstone block = last ledger block at 11 + 2 new blocks + 100 let prefix_tombstone = tx_prefix.get("tombstone_block").unwrap(); - assert_eq!(prefix_tombstone, "113"); + assert_eq!(prefix_tombstone, "23"); // Get current balance assert_eq!(ledger_db.num_blocks().unwrap(), 14); diff --git a/full-service/src/service/receipt.rs b/full-service/src/service/receipt.rs index b5fa4f7d1..fd9fc4ec0 100644 --- a/full-service/src/service/receipt.rs +++ b/full-service/src/service/receipt.rs @@ -469,7 +469,7 @@ mod tests { let txo_pubkey = mc_util_serial::decode(&txos[0].txo.public_key).expect("Could not decode pubkey"); assert_eq!(receipt.public_key, txo_pubkey); - assert_eq!(receipt.tombstone_block, 112); // Ledger seeded up to block 11 at tx construction, then one appended + 100 + assert_eq!(receipt.tombstone_block, 22); // Ledger seeded up to block 11 at tx construction, then one appended + 10 let txo: TxOut = mc_util_serial::decode(&txos[0].txo.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 b47f1b29f..a497ea050 100644 --- a/full-service/src/service/transaction_builder.rs +++ b/full-service/src/service/transaction_builder.rs @@ -30,7 +30,7 @@ use mc_mobilecoind::{ UnspentTxOut, }; use mc_transaction_core::{ - constants::{MAX_TOMBSTONE_BLOCKS, MINIMUM_FEE, RING_SIZE}, + constants::{MINIMUM_FEE, RING_SIZE}, onetime_keys::recover_onetime_private_key, ring_signature::KeyImage, tx::{TxOut, TxOutMembershipProof}, @@ -42,6 +42,10 @@ use diesel::prelude::*; use rand::Rng; use std::{convert::TryFrom, iter::FromIterator, str::FromStr, sync::Arc}; +/// Default number of blocks in the future to set the transaction tombstone +/// block. +const DEFAULT_TOMBSTONE_BLOCKS: u64 = 10; + /// A builder of transactions constructed from this wallet. pub struct WalletTransactionBuilder { /// Account ID (hex-encoded) from which to construct a transaction. @@ -174,7 +178,7 @@ impl WalletTransactionBuilder { tombstone } else { let last_block_index = self.ledger_db.num_blocks()? - 1; - last_block_index + MAX_TOMBSTONE_BLOCKS + last_block_index + DEFAULT_TOMBSTONE_BLOCKS }; self.tombstone = tombstone_block; Ok(()) @@ -821,7 +825,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, 112); + assert_eq!(proposal.tx.prefix.tombstone_block, 22); // Build a transaction and explicitly set tombstone let (recipient, mut builder) =