add electrum server to regtest docker

This commit is contained in:
f321x
2024-07-15 18:53:00 +02:00
parent e73b879546
commit 6949a7c29c
8 changed files with 1137 additions and 10 deletions

View File

@ -40,7 +40,7 @@ pub fn init_coordinator_wallet() -> Result<CoordinatorWallet<sled::Tree>> {
auth: Auth::Cookie {
file: env::var("BITCOIN_RPC_COOKIE_FILE_PATH")?.into(),
},
network: bdk::bitcoin::Network::Signet,
network: bdk::bitcoin::Network::Regtest,
wallet_name: env::var("BITCOIN_RPC_WALLET_NAME")?,
sync_params: None,
};
@ -51,7 +51,7 @@ pub fn init_coordinator_wallet() -> Result<CoordinatorWallet<sled::Tree>> {
let wallet = Wallet::new(
Bip86(wallet_xprv, KeychainKind::External),
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
bitcoin::Network::Signet,
bitcoin::Network::Regtest,
sled_db,
)?;
@ -276,7 +276,7 @@ mod tests {
auth: Auth::Cookie {
file: env::var("BITCOIN_RPC_COOKIE_FILE_PATH").unwrap().into(),
},
network: bdk::bitcoin::Network::Signet,
network: bdk::bitcoin::Network::Regtest,
wallet_name: env::var("BITCOIN_RPC_WALLET_NAME").unwrap(),
sync_params: None,
};
@ -287,7 +287,7 @@ mod tests {
let wallet = Wallet::new(
Bip86(wallet_xprv, KeychainKind::External),
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
Network::Signet,
Network::Regtest,
MemoryDatabase::new(),
)
.unwrap();

View File

@ -41,7 +41,7 @@ impl BondTx for Transaction {
fn bond_output_sum(&self, bond_address: &str) -> Result<u64> {
let bond_script = Address::from_str(bond_address)?
.require_network(Network::Signet)?
.require_network(Network::Regtest)?
.script_pubkey();
for output in self.output.iter() {

View File

@ -4,8 +4,30 @@ services:
container_name: bitcoin
ports:
- 8332:8332
networks:
- bitcoin
volumes:
- bitcoin:/home/bitcoin/.bitcoin
fulcrum:
build: ./fulcrum
container_name: fulcrum
ports:
- 5321:5321
volumes:
- fulcrum-volume:/home/fulcrum/fulcrum_data
networks:
- bitcoin
restart: always
depends_on:
bitcoin:
condition: service_started
volumes:
bitcoin:
bitcoin:
fulcrum-volume:
networks:
bitcoin:
driver: bridge

View File

@ -0,0 +1,18 @@
FROM debian:latest
RUN apt update
RUN mkdir -p /home/fulcrum
COPY ./fulcrum /home/fulcrum/.
COPY ./config.conf /home/fulcrum/.
WORKDIR /home/fulcrum
RUN mkdir fulcrum_data
RUN chmod +x ./fulcrum
EXPOSE 5321
#CMD ["tail", "-f"]
CMD ["./fulcrum", "config.conf"]

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -33,7 +33,7 @@ impl Bond {
debug!("Assembling bond transaction");
// parse bond locking address as Address struct and verify network is testnet
let address: Address =
Address::from_str(&bond_target.bond_address)?.require_network(Network::Signet)?;
Address::from_str(&bond_target.bond_address)?.require_network(Network::Regtest)?;
// build bond locking transaction. Use coin selection to add at least enough outputs
// to have the full trading sum as change as evidence for the coordinator that the maker owns
@ -84,7 +84,7 @@ mod tests {
let wallet = Wallet::new(
Bip86(wallet_xprv, KeychainKind::External),
Some(Bip86(wallet_xprv, KeychainKind::Internal)),
Network::Signet,
Network::Regtest,
MemoryDatabase::default(),
)
.unwrap();

View File

@ -27,7 +27,7 @@ pub struct TradingWallet {
pub fn get_wallet_xprv(xprv_input: Option<String>) -> Result<ExtendedPrivKey> {
let xprv: ExtendedPrivKey;
let network: Network = Network::Signet;
let network: Network = Network::Regtest;
if let Some(xprv_i) = xprv_input {
xprv = ExtendedPrivKey::from_str(&xprv_i)?;
@ -45,7 +45,7 @@ impl TradingWallet {
let wallet = Wallet::new(
Bip86(trader_config.wallet_xprv, KeychainKind::External),
Some(Bip86(trader_config.wallet_xprv, KeychainKind::Internal)),
bitcoin::Network::Signet,
bitcoin::Network::Regtest,
MemoryDatabase::default(), // non-permanent storage
)?;