Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multi: register with different assets, add BTC
This permits payment of registration fee in different assets, and adds BTC. * dex/msgjson: update config and register Asset ID in Register and RegisterResult. RegFees map in ConfigResult. New FeeAsset type. * server/db: external key derivation, add fee_asset Add FeeAsset uint32 to the db.Account type and accounts table. HD key derivation and address generation is no longer the role of the database driver. Add the db.KeyIndexer interface, which retrieves and records an integer index for a []byte, a serialized pubkey corresponding to a master pubkey's child and it's index. DEXArchivist is now required to be a KeyIndexer. CreateAccount now requires asset ID and reg address provided as inputs rather than it generating and returning a reg address. AccountRegAddr now also returns asset ID with the address. * server/asset: Addresser and HDKeyIndexer Add fee address generators to DCR and BTC. Implement FeeCoin (fee checker) in BTC. * server/auth: use multi-asset fee addressers and checkers * server/cmd/dcrdex: per-asset fee config * server/dex: per-asset fee stitching FeeCoiner and AddresserFactor provide the helpers for the auth manager. Update the config response with the RegFees field. Start archivist before asset backends because the fee Addressers require it for key index storage and retrieval. * client/{core.db}: multi-asset fees with FeeAssetID client/db: This adds db.AccountInfo.FeeAssetID uint32, and updates the DB encoding. v2 db.AccountInfo encoding is updated, and fields reordered. When earlier (v0/v1) blobs are loaded, FeeAssetID is loaded as 42. client/core: Add asset ID to RegisterForm. Add Exchange.RegFees map[string]*FeeAsset field, and a PendingFeeState struct field that describes the asset and confs of the pending fee, removing the RegConfirms ('confs') field. Also remove the ConfsRequired ('confsrequired') and FeePending ('feePending') fields. Add feeAssetID uint32 to dexAccount. In Core, use the Exchange.RegFees map, and deal with older servers providing the old config response. Change (*Core).GetFee to (*Core).GetRegFees, which is unused. Update FeePaymentNote with Asset *uint32. * client/rpcserver and dexcctl Kill getfee. Implement getdexconfig instead. * client/webserver: specify DCR/42, but update handlers Update apiRegister and registrationForm with asset ID. Kill apiGetFee. Modify js for pendingFee in FeePaymentNote, and removed confs and confsrequired from Exchange struct (this.market.dex). Frontend still defaults to DCR/42, no selection yet.
- Loading branch information