diff options
| author | Nsable-sh <nsable-sh@noreply.git.bitflash.network> | 2026-08-07 10:55:51 -0300 |
|---|---|---|
| committer | Bitflash <admin@bitflash.network> | 2026-08-07 11:05:09 -0300 |
| commit | 44004e350ba7a8e7e67338c8f7eb2589fbbf0a3c (patch) | |
| tree | 129b6cf79876669a2a6a402450b2fba481549f8a /src/main.cpp | |
| parent | d925be57e22213554b0ab2a64d7618611fedf81d (diff) | |
net: disable legacy order messages (#3)
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/src/main.cpp b/src/main.cpp index e149062..2610c45 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -3210,44 +3210,16 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) | |||
| 3210 | } | 3210 | } |
| 3211 | 3211 | ||
| 3212 | 3212 | ||
| 3213 | else if (strCommand == "checkorder") | 3213 | else if (strCommand == "checkorder" || strCommand == "submitorder") |
| 3214 | { | 3214 | { |
| 3215 | uint256 hashReply; | 3215 | // Legacy Bitcoin 0.1 marketplace messages are not part of Bitflash's |
| 3216 | CWalletTx order; | 3216 | // supported protocol. They used to let a remote peer make this wallet |
| 3217 | vRecv >> hashReply >> order; | 3217 | // reserve a key or import/broadcast a wallet transaction. Keep the |
| 3218 | 3218 | // command names explicit so old peers get a quiet no-op instead of a | |
| 3219 | /// we have a chance to check the order here | 3219 | // wallet side effect. |
| 3220 | 3220 | if (LogAcceptsCategory("net")) | |
| 3221 | // Keep giving the same key to the same ip until they use it | 3221 | printf("ProcessMessage(%s) : disabled legacy order message\n", strCommand.c_str()); |
| 3222 | if (!mapReuseKey.count(pfrom->addr.ip)) | 3222 | vRecv.clear(); |
| 3223 | mapReuseKey[pfrom->addr.ip] = GenerateNewKey(); | ||
| 3224 | |||
| 3225 | // Send back approval of order and pubkey to use | ||
| 3226 | CScript scriptPubKey; | ||
| 3227 | scriptPubKey << mapReuseKey[pfrom->addr.ip] << OP_CHECKSIG; | ||
| 3228 | pfrom->PushMessage("reply", hashReply, (int)0, scriptPubKey); | ||
| 3229 | } | ||
| 3230 | |||
| 3231 | |||
| 3232 | else if (strCommand == "submitorder") | ||
| 3233 | { | ||
| 3234 | uint256 hashReply; | ||
| 3235 | CWalletTx wtxNew; | ||
| 3236 | vRecv >> hashReply >> wtxNew; | ||
| 3237 | |||
| 3238 | // Broadcast | ||
| 3239 | if (!wtxNew.AcceptWalletTransaction()) | ||
| 3240 | { | ||
| 3241 | pfrom->PushMessage("reply", hashReply, (int)1); | ||
| 3242 | return error("submitorder AcceptWalletTransaction() failed, returning error 1"); | ||
| 3243 | } | ||
| 3244 | wtxNew.fTimeReceivedIsTxTime = true; | ||
| 3245 | AddToWallet(wtxNew); | ||
| 3246 | wtxNew.RelayWalletTransaction(); | ||
| 3247 | mapReuseKey.erase(pfrom->addr.ip); | ||
| 3248 | |||
| 3249 | // Send back confirmation | ||
| 3250 | pfrom->PushMessage("reply", hashReply, (int)0); | ||
| 3251 | } | 3223 | } |
| 3252 | 3224 | ||
| 3253 | 3225 | ||