No description
Find a file
Andrew Poelstra 23e91d0ef8
wallet: fix some fee calculation bugs
First, this reverts commit ca2d72ae8b to reinstate
an assertion that was added in Bitcoin #22686. It did not compile because our
`change_and_fee` variable is a map rather than number; I changed it to use
`map_change_and_fee.at(policyAsset)` to match the equivalent change 2 lines down
from a5d97b363b (merge of Bitcoin #22008).

Then fix the following bugs:

1. Change the new test in rpc_fundrawtransaction.py to bump the -maxtxfee value,
   which we'd otherwise exceed, failing the test and masking actual failures.
   (This was just caused by the extreme fee settings of the test combined with
   Elements' large transactions.)
2. Change the fee-output size estimation for `tx_noinputs_size` to be 46 rather
   than 44 bytes; we forgot that even null surjection/rangeproofs need a 0 byte
   when output witnesses are present. This mistake triggered the new assertion.
3. Correct the logic in which change outputs are sometimes dropped even when
   they are the only blinded output in a transaction with blinded inputs. This
   would cause the new test to fail with `bad-txn-inputs-ne-outputs`; I'm very
   surprised that no existing tests hit this.

   (I have an existing comment block in this code where I "promise" that I had
   a good reason for doing something mysterious related to blinding. I was not
   able to reverse-engineer my intention here, though I think it is related to
   this, but since I couldn't understand it I just left this block intact and
   worked around it.)
4. This then triggered the assertion again since the coin selection code
   assumes that sufficiently-small change will always be dropped. If we prevent
   this drop we will have under-funded the transaction.

   To fix this we add Yet Another Flag `may_need_blinded_dummy` in which we add
   extra weight to `tx_noinputs_size` in the case that we're doing a blinded tx
   but have no blind destinations. We turn this off after coin selection if it
   turns out that we don't have any blinded inputs, though ofc at that point
   much of the damage/inefficiency has already been done..
5. Fix some constants in other functional tests which assumed precise fee
   calculations; these precise values changed because of fixes (2) and (4).

There is one new FIXME, which is that the "dummy change" value will now be a
zero-valued OP_RETURN but we still put a full-size rangeproof and surjection
proof on it. There is some plausible privacy benefit to this but not much,
and wasting 5000+ bytes rather than the ~65 needed for an exact-value proof
is not worth it. We will fix this in the future when we overhaul the wallet
blinding logic.
2022-09-20 17:39:24 +00:00
.github doc: Remove label from good first issue template 2020-08-24 09:31:24 +02:00
.tx qt: Bump transifex slug for 22.x 2021-04-21 13:46:41 +02:00
build-aux/m4 Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00
build_msvc Merge a196c89317 into merged_master (Bitcoin PR bitcoin/bitcoin#22270) 2021-07-28 18:18:31 +00:00
ci ci: Disable one of the fuzz tests to work around bitcoin#22233 2022-05-25 19:47:48 -07:00
contrib Fix Icon position in dmg 2022-08-11 21:29:05 +00:00
depends Merge bitcoin/bitcoin#22436: build: use aarch64 Clang if cross-compiling for darwin on aarch64 2021-07-20 18:23:35 +08:00
doc lint: fix typo in tx-format doc 2022-09-07 14:44:07 +02:00
share Merge pull request #869 from stevenroose/win-installer 2022-09-06 15:50:12 -04:00
src wallet: fix some fee calculation bugs 2022-09-20 17:39:24 +00:00
test wallet: fix some fee calculation bugs 2022-09-20 17:39:24 +00:00
.appveyor.yml Switch Appveyor CI to VS2019 stable image 2021-06-14 20:35:00 +01:00
.cirrus.yml Add more CPUs to the fuzzer test 2022-09-06 18:55:06 +00:00
.editorconfig Add EditorConfig file. 2021-02-10 08:00:06 +01:00
.gitattributes Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00
.gitignore Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00
.python-version Bump minimum python version to 3.6 2020-11-09 17:53:47 +10:00
.style.yapf test: .style.yapf: Set column_limit=160 2019-03-04 18:28:13 -05:00
autogen.sh scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
configure.ac Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00
CONTRIBUTING.md Merge 933c6466c2 into merged_master (Bitcoin PR bitcoin/bitcoin#22109) 2021-07-19 19:25:00 +00:00
COPYING doc: Update license year range to 2021 2020-12-30 16:24:47 +01:00
INSTALL.md Update INSTALL landing redirection notice for build instructions. 2016-10-06 12:27:23 +13:00
libbitcoinconsensus.pc.in build: remove libcrypto as internal dependency in libbitcoinconsensus.pc 2019-11-19 15:03:44 +01:00
Makefile.am Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00
README.md Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00
REVIEWERS Update REVIEWERS: I've found that I keep track of PRs in need of review without the need for DrahtBot's automated notification :) 2021-06-10 09:00:05 +00:00
SECURITY.md Squashed 'src/secp256k1/' changes from 90580edcc9..7a30cb0c9d 2022-05-25 15:18:23 -07:00

Elements Project blockchain platform

Build Status

https://elementsproject.org

This is the integration and staging tree for the Elements blockchain platform, a collection of feature experiments and extensions to the Bitcoin protocol. This platform enables anyone to build their own businesses or networks pegged to Bitcoin as a sidechain or run as a standalone blockchain with arbitrary asset tokens.

Modes

Elements supports a few different pre-set chains for syncing. Note though some are intended for QA and debugging only:

  • Liquid mode: elementsd -chain=liquidv1 (syncs with Liquid network)
  • Bitcoin mainnet mode: elementsd -chain=main (not intended to be run for commerce)
  • Bitcoin testnet mode: elementsd -chain=testnet3
  • Bitcoin regtest mode: elementsd -chain=regtest
  • Elements custom chains: Any other -chain= argument. It has regtest-like default parameters that can be over-ridden by the user by a rich set of start-up options.

Confidential Assets

The latest feature in the Elements blockchain platform is Confidential Assets, the ability to issue multiple assets on a blockchain where asset identifiers and amounts are blinded yet auditable through the use of applied cryptography.

Features of the Elements blockchain platform

Compared to Bitcoin itself, it adds the following features:

Previous elements that have been integrated into Bitcoin:

  • Segregated Witness
  • Relative Lock Time

Elements deferred for additional research and standardization:

Additional RPC commands and parameters:

The CI (Continuous Integration) systems make sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.

License

Elements is released under the terms of the MIT license. See COPYING for more information or see http://opensource.org/licenses/MIT.

What is the Elements Project?

Elements is an open source, sidechain-capable blockchain platform. It also allows experiments to more rapidly bring technical innovation to the Bitcoin ecosystem.

Learn more on the Elements Project website

https://github.com/ElementsProject/elementsproject.github.io

Secure Reporting

See our vulnerability reporting guide