Allow user to change network magic, add constant for testnet
We need to add a "difficulty back to 1 after 20 minutes" difficulty rule to actually support testnet, but this is a start.
This commit is contained in:
parent
5ca37d3614
commit
b5fd47b334
|
@ -19,6 +19,7 @@
|
|||
//!
|
||||
|
||||
pub static MAGIC_BITCOIN: u32 = 0xD9B4BEF9;
|
||||
pub static MAGIC_TESTNET: u32 = 0x0709110B;
|
||||
|
||||
pub static PROTOCOL_VERSION: u32 = 70001;
|
||||
pub static SERVICES: u64 = 0;
|
||||
|
|
|
@ -31,10 +31,12 @@ pub trait Listener {
|
|||
fn peer<'a>(&'a self) -> &'a str;
|
||||
/// Return the port we have connected to the peer on
|
||||
fn port(&self) -> u16;
|
||||
/// Return the network magic
|
||||
fn magic(&self) -> u32;
|
||||
/// Main listen loop
|
||||
fn start(&self) -> IoResult<(Receiver<NetworkMessage>, Socket)> {
|
||||
// Open socket
|
||||
let mut ret_sock = Socket::new(constants::MAGIC_BITCOIN);
|
||||
let mut ret_sock = Socket::new(self.magic());
|
||||
match ret_sock.connect(self.peer(), self.port()) {
|
||||
Ok(_) => {},
|
||||
Err(_) => return Err(standard_error(ConnectionFailed))
|
||||
|
|
Loading…
Reference in New Issue