-
Notifications
You must be signed in to change notification settings - Fork 73
Add transactions multi-signing. #76
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,7 @@ _testmain.go | |
*.coverprofile | ||
|
||
.DS_Store | ||
|
||
# IDE specific | ||
.idea | ||
*.iml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,12 +133,16 @@ type Escrow struct { | |
DestinationNode *NodeIndex `json:",omitempty"` | ||
} | ||
|
||
type SignerEntry struct { | ||
type SignerEntryItem struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you got an example tx or ledge entry from mainnet which demonstrates this structure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a ledger entry and that example transaction is a Payment and does not modify the ledger entry. You need to find a SignerListSet transaction which changes the ledger entry to confirm that this change is necessary. I suspect it isn't, but happy to be proved wrong :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, that was the proof for the |
||
Account *Account `json:",omitempty"` | ||
SignerWeight *uint16 `json:",omitempty"` | ||
WalletLocator *Hash256 `json:",omitempty"` | ||
} | ||
|
||
type SignerEntry struct { | ||
SignerEntry SignerEntryItem | ||
} | ||
|
||
type SignerList struct { | ||
leBase | ||
Flags *LedgerEntryFlag `json:",omitempty"` | ||
|
@@ -233,7 +237,7 @@ func (s *Escrow) Affects(account Account) bool { | |
} | ||
func (s *SignerList) Affects(account Account) bool { | ||
for _, entry := range s.SignerEntries { | ||
if entry.Account != nil && entry.Account.Equals(account) { | ||
if entry.SignerEntry.Account != nil && entry.SignerEntry.Account.Equals(account) { | ||
return true | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
package data | ||
|
||
type MemoItem struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the previous embedded struct, it was convenient if you read the transaction, but if you create a transaction and you need to define the memo you would need to copy the embedded struct definition every time you do it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have been doing this:
Not particularly elegant, but does your change break this code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The proposed changes might be a breaking change depending on the way the memo is initialized. If it's initialized in the way you do - not breaching, but if in the way where you provide the embedded struct, it's breaking. That change is removed from that PR and will be moved to another. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR: #77 |
||
MemoType VariableLength | ||
MemoData VariableLength | ||
MemoFormat VariableLength | ||
} | ||
|
||
type Memo struct { | ||
Memo struct { | ||
MemoType VariableLength | ||
MemoData VariableLength | ||
MemoFormat VariableLength | ||
} | ||
Memo MemoItem | ||
} | ||
|
||
type Memos []Memo |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,10 @@ type Syncer interface { | |
} | ||
|
||
type CommandError struct { | ||
Name string `json:"error"` | ||
Code int `json:"error_code"` | ||
Message string `json:"error_message"` | ||
Name string `json:"error"` | ||
Code int `json:"error_code"` | ||
Message string `json:"error_message"` | ||
Exception string `json:"error_exception"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a new response field from somewhere? Docs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I've not found it in the spec. It was found in the responses from the You can try that code snippet (with updated code): func main() {
host := "wss://s.altnet.rippletest.net:51233/"
remote, err := websockets.NewRemote(host)
panicIfErr(err)
amount, err := data.NewAmount("100000") // 0.1 XRP tokens
tx := data.Payment{
Amount: *amount,
TxBase: data.TxBase{
TransactionType: data.PAYMENT,
},
}
// submit the transaction
_, err = remote.Submit(&tx)
fmt.Printf("%s\n", err)
}
func panicIfErr(err error) {
if err != nil {
panic(err)
}
} The output:
Raw response. {"error":"invalidTransaction","error_exception":"gFID: uncommon type out of range 0","id":1,"request":{"command":"submit","id":1,"tx_blob":"12000024000000006140000000000186A06880000000000000008114000000000000000000000000000000000000000083140000000000000000000000000000000000000000"},"status":"error","type":"response"} The output if you run it from the master:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be in a separate PR too. Just in case anyone needs to check the commit history to easily see where changes have been added. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed from that PR. And will be in a different PR. |
||
} | ||
|
||
type Command struct { | ||
|
@@ -48,7 +49,7 @@ func (c *Command) IncrementId() { | |
} | ||
|
||
func (e *CommandError) Error() string { | ||
return fmt.Sprintf("%s %d %s", e.Name, e.Code, e.Message) | ||
return fmt.Sprintf("%s %d %s %s", e.Name, e.Code, e.Message, e.Exception) | ||
} | ||
|
||
func newCommand(command string) *Command { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to split to
MILTI_SIGN
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/MILTISIGN/MULTISIGN/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed.