mirror of
https://github.com/GOSTSec/poolserver
synced 2025-02-06 12:04:29 +00:00
Updated for Peercoin
This commit is contained in:
parent
0fccd298c6
commit
4931afd7ed
@ -61,7 +61,7 @@ void NetworkMgr::UpdateBlockTemplate()
|
||||
|
||||
// Add coinbase tx
|
||||
BinaryData pubkey = Util::ASCIIToBin(sConfig.Get<std::string>("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"];
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "VarInt.h"
|
||||
#include "Script.h"
|
||||
#include "BigNum.h"
|
||||
#include "Util.h"
|
||||
#include <gmpxx.h>
|
||||
|
||||
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;
|
||||
|
@ -18,6 +18,7 @@ namespace Bitcoin
|
||||
uint32 time;
|
||||
uint32 bits;
|
||||
uint32 nonce;
|
||||
BinaryData signature;
|
||||
};
|
||||
|
||||
class Block : public BlockHeader
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ namespace Bitcoin
|
||||
{
|
||||
public:
|
||||
uint32 version;
|
||||
uint32 time;
|
||||
std::vector<TxIn> in;
|
||||
std::vector<TxOut> out;
|
||||
uint32 lockTime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user