Fix build, harden payment processing, and make deployment fork-agnostic - #1
Open
jzbz wants to merge 8 commits into
Open
Fix build, harden payment processing, and make deployment fork-agnostic#1jzbz wants to merge 8 commits into
jzbz wants to merge 8 commits into
Conversation
- Replace the Decred logo with the official mark - Fix CryptoImagePath: the embedded SVG is served at /decred.svg, not /Resources/img/decred.svg, so the checkout icon was 404ing - Switch the default rate source from poloniex DCR/BTC to kraken DCR/USD
- Use the store's configured account for getnewaddress instead of always using "default"; the AccountName setting was previously ignored - Make the DecredRpcProvider summary cache thread-safe (ConcurrentDictionary) - Return a clear error on non-JSON wallet responses instead of an opaque JObject.Parse failure - Remove the unauthenticated, unused daemon callback controller - Render the payment-data transaction link via the registered link provider rather than a hardcoded explorer URL - Collapse the redundant poll-cycle event publish - Delete unused DecredMoney, DecredPaymentViewModel, and the SyncStatus/ EstimateSmartFee models
- decred.yml, README: pull ${BTCPAY_DCR_IMAGE:-ghcr.io/decred/decred:2.1.5};
deployers override the image via BTCPAY_DCR_IMAGE, default is the upstream
decred org image so the repo carries no fork-specific reference
- docker.yml: drive the build/tag from a DECRED_VERSION env (2.1.5) instead
of the plugin's git tag, so cutting a vX.Y.Z plugin release no longer tries
to fetch a non-existent Decred release
…EADME - README: write BTCPAY_DCR_WALLET_PASSPHRASE to $BTCPAY_BASE_DIRECTORY/.env rather than exporting it, so dcrwallet can unlock on every (re)start; btcpay-setup.sh does not persist custom variables - README: credit the Decred project (https://github.com/decred) - LICENSE: copyright to The Decred developers
…scoping - Validate antiforgery tokens on the settings and wallet-send POST actions; BTCPay has no global antiforgery filter, so the rendered tokens were never checked - the send endpoint was CSRF-reachable under cookie auth - Sum transaction outputs paying the same address in all three payment detection paths; one entry per output previously deduped by txid, so a payment split across outputs of one tx was undercounted and the invoice never settled - Use dcrwallet's syncstatus RPC for the synced flag instead of blocks > 0, which reported synced during initial SPV sync; keep the old check as a fallback for wallets without syncstatus - Restrict wallet send to server admins: the dcrwallet instance is shared by the whole server, so store-settings permission on any store must not spend it; scope the balance shown and validated to the store's configured account and send via sendfrom, since sendtoaddress only spends the default account while receives can land in a custom one
- Use RedirectToAction and anchor tag helpers instead of hardcoded root-relative /stores/... URLs, which broke under BTCPAY_ROOTPATH - Set a 15s HttpClient timeout so an unreachable wallet endpoint cannot stall the polling loop for the default 100s - Run dcrwallet with --gaplimit=200 in the compose fragment and document the seed-restore implications; invoice addresses are generated past the gap limit, so restores with the default limit would miss funds - Support optional TLS pinning of dcrwallet's rpc.cert via BTCPAY_DCR_RPC_CERT, failing closed if the file cannot be loaded; accept-any stays the default for the private compose network - Fall back to the store speed policy for the settlement threshold (mirroring the core Bitcoin listener) instead of hardcoding 1 confirmation; the settings UI already claimed this behavior - Record payment Created from the transaction time, not detection time - Drop the redundant Task.Run around address reservation, null-guard the JSON-RPC result field, and collapse the block/tx poll distinction the listener never differentiated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the plugin to a working, deployable state against BTCPay Server >= 2.1.0, verified end-to-end on a fresh server running a Decred-only (no-Bitcoin) deployment. Fixes a build break, two payment-correctness bugs, a CSRF gap and a send-authorization gap, hardens the dcrwallet RPC integration, and removes fork-specific references from the deployment files.
Security
BTCPAY_DCR_RPC_CERT(fails closed if the file cannot be loaded); accept-any remains the default for the private compose network.Payment correctness
syncstatusRPC for the synced flag instead ofblocks > 0, which reported synced during initial SPV sync.sendfrom;sendtoaddressonly spends the default account while receives can land in a custom one, and the balance check was wallet-wide.Plugin / runtime
using System.Collections.ConcurrentinDecredRpcProvider(the project does not enable ImplicitUsings).BTCPAY_ROOTPATH.Deployment & CI
${BTCPAY_DCR_IMAGE:-ghcr.io/decred/decred:2.1.5}- the default is the Decred org image, deployers can override without editing tracked files.DECRED_VERSIONenv instead of the plugin's git tag, so cutting a vX.Y.Z plugin release no longer tries to fetch a non-existent Decred release.--gaplimit=200: invoice addresses are generated past the gap limit, so restores from seed with the default limit would miss funds.BTCPAY_DCR_WALLET_PASSPHRASEmust be written to$BTCPAY_BASE_DIRECTORY/.env(btcpay-setup.sh does not persist custom variables; without this dcrwallet crash-loops on restart).Testing
Deployed on a fresh VPS in Decred-only mode (
BTCPAYGEN_CRYPTO1=none, plugin added viaBTCPAYGEN_ADDITIONAL_FRAGMENTS):DCR wallet availability changed to True)