Implement RBF and add a few tests

This commit is contained in:
Alekos Filini
2020-08-13 16:51:27 +02:00
parent 8f8c393f6f
commit c12aa3d327
7 changed files with 1167 additions and 70 deletions

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()