diff options
| author | Max K. <[email protected]> | 2015-08-06 22:14:47 +0200 |
|---|---|---|
| committer | Max K. <[email protected]> | 2015-08-06 22:14:47 +0200 |
| commit | 3b7279e96dbe106dbc7d0fc5814e4507f4c08861 (patch) | |
| tree | 33d136deea3e8a96e9e232824cab6f71ebe8bfab /src | |
| parent | Merge pull request #1225 from rnicoll/1.10-constants (diff) | |
| parent | Revised payment request handling to use genesis block hash instead of network... (diff) | |
| download | discoin-3b7279e96dbe106dbc7d0fc5814e4507f4c08861.tar.xz discoin-3b7279e96dbe106dbc7d0fc5814e4507f4c08861.zip | |
Merge pull request #1220 from rnicoll/1.10-paymentprotocol
Revised payment request handling to use genesis block hash
Diffstat (limited to 'src')
| -rw-r--r-- | src/qt/paymentrequest.proto | 17 | ||||
| -rw-r--r-- | src/qt/paymentserver.cpp | 11 |
2 files changed, 15 insertions, 13 deletions
diff --git a/src/qt/paymentrequest.proto b/src/qt/paymentrequest.proto index b2281c4c7..964d6e173 100644 --- a/src/qt/paymentrequest.proto +++ b/src/qt/paymentrequest.proto @@ -1,22 +1,23 @@ // -// Simple Bitcoin Payment Protocol messages +// Simple Dogecoin Payment Protocol messages +// Derived fromthe Bitcoin Payment Protocol // // Use fields 100+ for extensions; -// to avoid conflicts, register extensions at: -// https://en.bitcoin.it/wiki/Payment_Request +// to avoid conflicts, register extensions via pull-req at: +// https://github.com/dogecoin/dips // package payments; -option java_package = "org.bitcoin.protocols.payments"; +option java_package = "com.dogecoin.protocols.payments"; option java_outer_classname = "Protos"; -// Generalized form of "send payment to this/these bitcoin addresses" +// Generalized form of "send payment to this/these dogecoin addresses" message Output { - optional uint64 amount = 1 [default = 0]; // amount is integer-number-of-satoshis - required bytes script = 2; // usually one of the standard Script forms + optional uint64 amount = 1 [default = 0]; // amount is integer-number-of-satoshis + required bytes script = 2; // usually one of the standard Script forms } message PaymentDetails { - optional string network = 1 [default = "main"]; // "main" or "test" + optional string genesis = 1 [default = "1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691"]; // Hash of the network genesis block repeated Output outputs = 2; // Where payment should be sent required uint64 time = 3; // Timestamp; when payment request created optional uint64 expires = 4; // Timestamp; when this request should be considered invalid diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 09e9949b1..6e4206e6f 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -241,11 +241,11 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[]) PaymentRequestPlus request; if (readPaymentRequestFromFile(arg, request)) { - if (request.getDetails().network() == "main") + if (request.getDetails().genesis() == "1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691") { SelectParams(CBaseChainParams::MAIN); } - else if (request.getDetails().network() == "test") + else if (request.getDetails().genesis() == "bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e") { SelectParams(CBaseChainParams::TESTNET); } @@ -770,12 +770,13 @@ void PaymentServer::handlePaymentACK(const QString& paymentACKMsg) bool PaymentServer::verifyNetwork(const payments::PaymentDetails& requestDetails) { - bool fVerified = requestDetails.network() == Params().NetworkIDString(); + Consensus::Params consensus = Params().GetConsensus(0); + bool fVerified = requestDetails.genesis() == consensus.hashGenesisBlock.GetHex(); if (!fVerified) { qWarning() << QString("PaymentServer::%1: Payment request network \"%2\" doesn't match client network \"%3\".") .arg(__func__) - .arg(QString::fromStdString(requestDetails.network())) - .arg(QString::fromStdString(Params().NetworkIDString())); + .arg(QString::fromStdString(requestDetails.genesis())) + .arg(QString::fromStdString(consensus.hashGenesisBlock.GetHex())); } return fVerified; } |