(ctx contractapi.TransactionContextInterface, id int)
| 215 | } |
| 216 | |
| 217 | func readHomeByID(ctx contractapi.TransactionContextInterface, id int) (*Home, error) { |
| 218 | addressBytes, err := ctx.GetStub().GetState(homeIDKey(id)) |
| 219 | if err != nil { |
| 220 | return nil, fmt.Errorf("failed to read home id %d: %w", id, err) |
| 221 | } |
| 222 | if addressBytes == nil { |
| 223 | return nil, fmt.Errorf("home id %d does not exist", id) |
| 224 | } |
| 225 | return readHome(ctx, string(addressBytes)) |
| 226 | } |
| 227 | |
| 228 | func validSignature(address string, signature string) bool { |
| 229 | return signature == address+"1" |