func LoadOrCreateDepositAddress(userId int64, wallet string, coin string) string { user := auth.LoadUser(userId) chainPath := fmt.Sprintf("%v/%v", bitcoin.CHAINPATH_PREFIX_DEPOSIT, user.ChainIdx) address := bitcoin.LoadLastAddressByWallet(userId, wallet, coin) if address == nil { address = bitcoin.CreateNewAddress(coin, userId, wallet, hotMPK, chainPath) } return address.Address }
// dry: uses a different chainpath meant to throw away. func createNewSweepAddress(coin string, mpk *bitcoin.MPK, dry bool) string { var chainPath string var wallet string if dry { chainPath = fmt.Sprintf("%v", bitcoin.CHAINPATH_PREFIX_SWEEP_DRY) wallet = account.WALLET_SWEEP_DRY } else { chainPath = fmt.Sprintf("%v", bitcoin.CHAINPATH_PREFIX_SWEEP) wallet = account.WALLET_SWEEP } address := bitcoin.CreateNewAddress(coin, 0, wallet, mpk, chainPath) return address.Address }
func createNewChangeAddress(coin string) string { chainPath := fmt.Sprintf("%v", bitcoin.CHAINPATH_PREFIX_CHANGE) address := bitcoin.CreateNewAddress(coin, 0, "change", hotMPK, chainPath) return address.Address }