bitcoind: add the timestamp to the 'listdescriptors' entry
This commit is contained in:
parent
3c75e2e944
commit
337f422283
@ -472,8 +472,18 @@ impl BitcoinD {
|
||||
.try_into()
|
||||
.expect("Range is always an array of size 2")
|
||||
});
|
||||
let timestamp = elem
|
||||
.get("timestamp")
|
||||
.and_then(Json::as_u64)
|
||||
.expect("A valid timestamp is always present")
|
||||
.try_into()
|
||||
.expect("timestamp must fit");
|
||||
|
||||
ListDescEntry { desc, range }
|
||||
ListDescEntry {
|
||||
desc,
|
||||
range,
|
||||
timestamp,
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@ -894,6 +904,7 @@ fn roundup_progress(progress: f64) -> f64 {
|
||||
pub struct ListDescEntry {
|
||||
pub desc: String,
|
||||
pub range: Option<[u32; 2]>,
|
||||
pub timestamp: u32,
|
||||
}
|
||||
|
||||
/// A 'received' entry in the 'listsinceblock' result.
|
||||
|
||||
@ -516,10 +516,10 @@ mod tests {
|
||||
let net_resp = [
|
||||
"HTTP/1.1 200\n\r\n{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"descriptors\":[{\"desc\":\"".as_bytes(),
|
||||
receive_desc.as_bytes(),
|
||||
"\"},".as_bytes(),
|
||||
"\",\"timestamp\":0},".as_bytes(),
|
||||
"{\"desc\":\"".as_bytes(),
|
||||
change_desc.as_bytes(),
|
||||
"\"}]}}\n".as_bytes(),
|
||||
"\",\"timestamp\":1}]}}\n".as_bytes(),
|
||||
]
|
||||
.concat();
|
||||
let (mut stream, _) = server.accept().unwrap();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user