Skip to content

Commit

Permalink
nakamoto: update the version of the library
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Dec 26, 2023
1 parent d3272bf commit e3dfb83
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions folgore-nakamoto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ edition = "2021"


[dependencies]
nakamoto-client = { git = "https://github.com/vincenzopalazzo/nakamoto", branch = "macros/client_model-fixes" }
nakamoto-net-poll = { git = "https://github.com/vincenzopalazzo/nakamoto", branch = "macros/client_model-fixes" }
nakamoto-p2p = { git = "https://github.com/vincenzopalazzo/nakamoto", branch = "macros/client_model-fixes" }
nakamoto-common = { git = "https://github.com/vincenzopalazzo/nakamoto", branch = "macros/client_model-fixes" }
nakamoto-client = { git = "https://github.com/cloudhead/nakamoto" }
nakamoto-net-poll = { git = "https://github.com/cloudhead/nakamoto" }
nakamoto-p2p = { git = "https://github.com/cloudhead/nakamoto" }
nakamoto-common = { git = "https://github.com/cloudhead/nakamoto" }
folgore-common = { path = "../folgore-common" }

serde_json = "1.0"
10 changes: 6 additions & 4 deletions folgore-nakamoto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ use std::sync::Mutex;
use std::thread::JoinHandle;

use nakamoto_client::handle::Handle;
use nakamoto_client::model::Tip;
use nakamoto_client::FeeRate;
use nakamoto_common::bitcoin::consensus::{deserialize, serialize};
use nakamoto_common::bitcoin::Txid;
use nakamoto_common::bitcoin_hashes::hex::{FromHex, ToHex};
use nakamoto_common::block::{Height, Transaction};
use nakamoto_net_poll::{Reactor, Waker};
use nakamoto_p2p::fsm::fees::FeeRate;
use serde_json::{json, Value};

use folgore_common::client::fee_estimator::{FeePriority, FEE_RATES};
Expand Down Expand Up @@ -165,7 +164,7 @@ impl<T: Clone> FolgoreBackend<T> for Nakamoto {
known_height: Option<u64>,
) -> Result<Value, PluginError> {
match self.handler.get_tip() {
Ok(Tip { mut height, .. }) => {
Ok((height, ..)) => {
let mut is_sync = true;
if Some(height) <= known_height {
while let Err(err) = self
Expand Down Expand Up @@ -212,6 +211,8 @@ impl<T: Clone> FolgoreBackend<T> for Nakamoto {
let mut fee_map = HashMap::new();
for FeePriority(block, _) in FEE_RATES.iter().cloned() {
let diff = block as u64;
// FIXME: use a separate backend to estiamte the fee, maybe look at
// the neutrino API?
let Ok(Some(fees)) = self.handler.estimate_feerate(height - diff) else {

Check failure on line 216 in folgore-nakamoto/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (stable)

no method named `estimate_feerate` found for struct `nakamoto_client::Handle` in the current scope

Check failure on line 216 in folgore-nakamoto/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (beta)

no method named `estimate_feerate` found for struct `nakamoto_client::Handle` in the current scope

Check failure on line 216 in folgore-nakamoto/src/lib.rs

View workflow job for this annotation

GitHub Actions / Build (nightly)

no method named `estimate_feerate` found for struct `nakamoto_client::Handle` in the current scope
continue;
};
Expand All @@ -235,14 +236,15 @@ impl<T: Clone> FolgoreBackend<T> for Nakamoto {
let txid = Txid::from_hex(txid).map_err(|err| error!("{err}"))?;
let Some(utxo) = self
.handler
.get_utxo(&txid, idx.try_into().map_err(|err| error!("{err}"))?)
.get_submitted_transaction(&txid)
.map_err(from)?
else {
return Ok(json!({
"amount": null,
"script": null,
}));
};
let utxo = utxo.output[idx as usize];
let mut resp = json_utils::init_payload();
json_utils::add_number(
&mut resp,
Expand Down

0 comments on commit e3dfb83

Please sign in to comment.