Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a "sweep" command to kaspawallet #2018

Merged
merged 13 commits into from Apr 13, 2022
Merged

Adds a "sweep" command to kaspawallet #2018

merged 13 commits into from Apr 13, 2022

Conversation

D-Stacks
Copy link
Contributor

@D-Stacks D-Stacks commented Apr 13, 2022

Implements #1990

Overveiw:

  1. allows for broadcasting of serialized externalapi.DomainTransactions
  2. allows the kaspawallet server to query UTXOs of external addresses
  3. implements logic of: extracting a associated address, as well as, utxos from a schnorr private key. Creates a new wallet address. Creates, signs and splits transaction(s) with a schnorr private key, and finnally broadcasts it.

cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
cmd/kaspawallet/sweep.go Outdated Show resolved Hide resolved
//[1] represents the tested unsigned transaction
dummyTransactionWindow[1] = newDummyTransaction()
lastValidTx := newDummyTransaction()
currentTx := newDummyTransaction() //i.e. the tested tx

//loop through utxos commit segments that don't violate max mass
for i, currentUTXO := range selectedUTXOs {

if currentIdxOfSplit == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variable is actually doing nothing. On the first iteration lastValidTx and currentTx are actually fresh and empty, and you reset them every time you set currentIdxOfSplit to 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentIdxOfSplit? this is needed to reset lastValidTx and currentTx, for a new split transaction. I agree it doen't do anything during the first iteration, so if you want I can do an extra check with && i != 0 before entering the scope. But it is needed to reset the Txs after each split, excluding the first.

@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #2018 (d81e6bd) into dev (723aebb) will decrease coverage by 0.41%.
The diff coverage is 0.00%.

❗ Current head d81e6bd differs from pull request most recent head 24be7bb. Consider uploading reports for the commit 24be7bb to get more accurate results

@@            Coverage Diff             @@
##              dev    #2018      +/-   ##
==========================================
- Coverage   59.78%   59.37%   -0.42%     
==========================================
  Files         667      671       +4     
  Lines       31795    32033     +238     
==========================================
+ Hits        19008    19018      +10     
- Misses      10058    10287     +229     
+ Partials     2729     2728       -1     
Impacted Files Coverage Δ
cmd/kaspawallet/balance.go 0.00% <0.00%> (ø)
cmd/kaspawallet/config.go 0.00% <0.00%> (ø)
cmd/kaspawallet/daemon/server/broadcast.go 0.00% <0.00%> (ø)
...pawallet/daemon/server/external_spendable_utxos.go 0.00% <0.00%> (ø)
cmd/kaspawallet/daemon/server/send.go 0.00% <0.00%> (ø)
cmd/kaspawallet/libkaspawallet/converters.go 0.00% <0.00%> (ø)
...llet/libkaspawallet/serialization/serialization.go 79.25% <0.00%> (-3.53%) ⬇️
cmd/kaspawallet/main.go 0.00% <0.00%> (ø)
cmd/kaspawallet/sweep.go 0.00% <0.00%> (ø)
cmd/kaspawallet/utils/format_kas.go 0.00% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 723aebb...24be7bb. Read the comment docs.

@someone235 someone235 merged commit 57c6118 into kaspanet:dev Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants