Implement RBF and add a few tests

This commit is contained in:
Alekos Filini committed 2020-08-14 12:48:07 +02:00
1 parent 8f8c393f6f
commit c12aa3d327
7 files changed
+1167 -70

No files matched your search

+3 -3
View File
@@ -96,11 +96,11 @@ pub trait DatabaseUtils: Database {
fn get_previous_output(&self, outpoint: &OutPoint) -> Result<Option<TxOut>, Error> {
self.get_raw_tx(&outpoint.txid)?
.and_then(|previous_tx| {
.map(|previous_tx| {
if outpoint.vout as usize >= previous_tx.output.len() {
Some(Err(Error::InvalidOutpoint(outpoint.clone())))
Err(Error::InvalidOutpoint(outpoint.clone()))
} else {
Some(Ok(previous_tx.output[outpoint.vout as usize].clone()))
Ok(previous_tx.output[outpoint.vout as usize].clone())
}
})
.transpose()