mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:56:43 +02:00
actually send signed transaction from PaymentManager
This commit is contained in:
parent
350c759618
commit
ce4336894a
3 changed files with 17 additions and 1 deletions
|
@ -13,6 +13,9 @@
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QUuid>
|
#include <QtCore/QUuid>
|
||||||
|
|
||||||
|
#include <NodeList.h>
|
||||||
|
#include <PacketHeaders.h>
|
||||||
|
|
||||||
#include "SignedWalletTransaction.h"
|
#include "SignedWalletTransaction.h"
|
||||||
|
|
||||||
#include "PaymentManager.h"
|
#include "PaymentManager.h"
|
||||||
|
@ -23,7 +26,6 @@ PaymentManager& PaymentManager::getInstance() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaymentManager::sendSignedPayment(qint64 satoshiAmount, const QUuid& nodeUUID, const QUuid& destinationWalletUUID) {
|
void PaymentManager::sendSignedPayment(qint64 satoshiAmount, const QUuid& nodeUUID, const QUuid& destinationWalletUUID) {
|
||||||
qDebug() << "Paying" << satoshiAmount << "satoshis to" << destinationWalletUUID << "via" << nodeUUID;
|
|
||||||
|
|
||||||
// setup a signed wallet transaction
|
// setup a signed wallet transaction
|
||||||
const qint64 DEFAULT_TRANSACTION_EXPIRY_SECONDS = 60;
|
const qint64 DEFAULT_TRANSACTION_EXPIRY_SECONDS = 60;
|
||||||
|
@ -32,4 +34,15 @@ void PaymentManager::sendSignedPayment(qint64 satoshiAmount, const QUuid& nodeUU
|
||||||
currentTimestamp, DEFAULT_TRANSACTION_EXPIRY_SECONDS);
|
currentTimestamp, DEFAULT_TRANSACTION_EXPIRY_SECONDS);
|
||||||
|
|
||||||
// send the signed transaction to the redeeming node
|
// send the signed transaction to the redeeming node
|
||||||
|
QByteArray transactionByteArray = byteArrayWithPopulatedHeader(PacketTypeSignedTransactionPayment);
|
||||||
|
|
||||||
|
// append the binary message and the signed message digest
|
||||||
|
transactionByteArray.append(newTransaction.binaryMessage());
|
||||||
|
transactionByteArray.append(newTransaction.signedMessageDigest());
|
||||||
|
|
||||||
|
qDebug() << "Paying" << satoshiAmount << "satoshis to" << destinationWalletUUID << "via" << nodeUUID;
|
||||||
|
|
||||||
|
// use the NodeList to send that to the right node
|
||||||
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
nodeList->writeDatagram(transactionByteArray, nodeList->nodeWithUUID(nodeUUID));
|
||||||
}
|
}
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <WalletTransaction.h>
|
#include <WalletTransaction.h>
|
||||||
|
|
||||||
|
const int NUM_BYTES_SIGNED_TRANSACTION_MESSAGE = 72;
|
||||||
|
|
||||||
class SignedWalletTransaction : public WalletTransaction {
|
class SignedWalletTransaction : public WalletTransaction {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -70,6 +70,7 @@ enum PacketType {
|
||||||
PacketTypeVoxelEditNack,
|
PacketTypeVoxelEditNack,
|
||||||
PacketTypeParticleEditNack,
|
PacketTypeParticleEditNack,
|
||||||
PacketTypeModelEditNack,
|
PacketTypeModelEditNack,
|
||||||
|
PacketTypeSignedTransactionPayment
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef char PacketVersion;
|
typedef char PacketVersion;
|
||||||
|
|
Loading…
Reference in a new issue