Skip to content

Commit

Permalink
fix: add unit test and change log entry
Browse files Browse the repository at this point in the history
  • Loading branch information
jcnelson committed Mar 1, 2023
1 parent 7638dfc commit ebce622
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the versioning scheme outlined in the [README.md](README.md).

## [Unreleased]

### Fixed

- Handle the case where a bitcoin node returns zero headers (#3588)

## [2.1]

This is a **consensus-breaking** release that introduces a _lot_ of new
Expand Down
20 changes: 20 additions & 0 deletions src/burnchains/bitcoin/spv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1832,4 +1832,24 @@ mod test {

let deserialized: Vec<Vec<u8>> = deserialize(&encoded_tx).unwrap();
}

#[test]
fn test_handle_headers_empty() {
let headers_path = "/tmp/test-spv-handle_headers_empty.dat";
if fs::metadata(headers_path).is_ok() {
fs::remove_file(headers_path).unwrap();
}

let mut spv_client = SpvClient::new(
headers_path,
0,
None,
BitcoinNetworkType::Regtest,
true,
false,
)
.unwrap();

spv_client.handle_headers(1, vec![]).unwrap();
}
}

0 comments on commit ebce622

Please sign in to comment.