diff --git a/src/server/poolserver/NetworkMgr/NetworkMgr.cpp b/src/server/poolserver/NetworkMgr/NetworkMgr.cpp index a40fe21..403e286 100644 --- a/src/server/poolserver/NetworkMgr/NetworkMgr.cpp +++ b/src/server/poolserver/NetworkMgr/NetworkMgr.cpp @@ -61,7 +61,7 @@ void NetworkMgr::UpdateBlockTemplate() // Add coinbase tx BinaryData pubkey = Util::ASCIIToBin(sConfig.Get("MiningAddress")); - block->tx.push_back(Bitcoin::CreateCoinbaseTX(_blockHeight, pubkey, response["coinbasevalue"].GetInt())); + block->tx.push_back(Bitcoin::CreateCoinbaseTX(_blockHeight, pubkey, response["coinbasevalue"].GetInt(), Util::ASCIIToBin("D7PoolBeta"))); // Add other transactions JSON trans = response["transactions"]; diff --git a/src/server/shared/Bitcoin/Bitcoin.h b/src/server/shared/Bitcoin/Bitcoin.h index eadf469..e36b214 100644 --- a/src/server/shared/Bitcoin/Bitcoin.h +++ b/src/server/shared/Bitcoin/Bitcoin.h @@ -6,6 +6,7 @@ #include "VarInt.h" #include "Script.h" #include "BigNum.h" +#include "Util.h" #include namespace Bitcoin @@ -31,12 +32,12 @@ namespace Bitcoin return BigInt(bits & 0xFFFFFF) * BigInt(power); } - inline Transaction CreateCoinbaseTX(uint32 blockHeight, BinaryData pubkey, int64 value) + inline Transaction CreateCoinbaseTX(uint32 blockHeight, BinaryData pubkey, int64 value, BinaryData extras) { // Extranonce placeholder BinaryData extranonce_ph(8, 0); ByteBuffer scriptsig; - scriptsig << blockHeight << extranonce_ph; + scriptsig << blockHeight << extranonce_ph << extras; Bitcoin::OutPoint outpoint; outpoint.hash.resize(32, 0); @@ -53,6 +54,7 @@ namespace Bitcoin Transaction tx; tx.version = 1; + tx.time = Util:Date(); tx.in.push_back(txin); tx.out.push_back(txout); tx.lockTime = 0; diff --git a/src/server/shared/Bitcoin/Block.h b/src/server/shared/Bitcoin/Block.h index 084c181..0e41be5 100644 --- a/src/server/shared/Bitcoin/Block.h +++ b/src/server/shared/Bitcoin/Block.h @@ -18,6 +18,7 @@ namespace Bitcoin uint32 time; uint32 bits; uint32 nonce; + BinaryData signature; }; class Block : public BlockHeader diff --git a/src/server/shared/Bitcoin/Serialization.cpp b/src/server/shared/Bitcoin/Serialization.cpp index a54756f..80db6f4 100644 --- a/src/server/shared/Bitcoin/Serialization.cpp +++ b/src/server/shared/Bitcoin/Serialization.cpp @@ -100,6 +100,7 @@ ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, TxOut& b) ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Transaction& b) { a << b.version; + a << b.time; // Inputs VarInt insize(b.in.size()); @@ -120,6 +121,7 @@ ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Transaction& b) ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Transaction& b) { a >> b.version; + a >> b.time; // Inputs VarInt insize; @@ -158,6 +160,8 @@ ByteBuffer& Bitcoin::operator<<(ByteBuffer& a, Block& b) for (uint64 i = 0; i < txcount; ++i) a << b.tx[i]; + a << b.signature; + return a; } ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Block& b) @@ -176,5 +180,7 @@ ByteBuffer& Bitcoin::operator>>(ByteBuffer& a, Block& b) for (uint64 i = 0; i < txcount; ++i) a >> b.tx[i]; + a >> b.signature; + return a; } diff --git a/src/server/shared/Bitcoin/Transaction.h b/src/server/shared/Bitcoin/Transaction.h index 9b6c584..adddd53 100644 --- a/src/server/shared/Bitcoin/Transaction.h +++ b/src/server/shared/Bitcoin/Transaction.h @@ -47,6 +47,7 @@ namespace Bitcoin { public: uint32 version; + uint32 time; std::vector in; std::vector out; uint32 lockTime;