Closed sbddesign closed 3 months ago
Tested double POSTing to simulate a user double clicking or some other spasm. Unable to get a duplicate through.
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 './duplicate-test <userName>'"
exit 1
fi
URL="http://localhost:3000/v2/record"
USERNAME="$1"
DATA="{\"domain\": \"12cash.dev\", \"userName\": \"$USERNAME\", \"lno\": \"lno123...xyz\"}"
run_curl() {
echo "Running POST request with userName: $USERNAME"
curl -X POST -H "Content-Type: application/json" -d "$DATA" "$URL"
echo -e "\n"
}
run_curl &
run_curl &
wait
./duplicate-test.sh cw-test-8
Running POST request with userName: cw-test-8
Running POST request with userName: cw-test-8
{"message":"Bip353 Address Created","bip353":"cw-test-8@regtest.12cash.dev"}
{"error":{"message":"Failed to update DNS record","errors":[{"message":"Name is already taken."}]}}
dig txt cw-test-8.user._bitcoin-payment.regtest.12cash.dev
; <<>> DiG 9.10.6 <<>> txt cw-test-8.user._bitcoin-payment.regtest.12cash.dev
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29779
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;cw-test-8.user._bitcoin-payment.regtest.12cash.dev. IN TXT
;; ANSWER SECTION:
cw-test-8.user._bitcoin-payment.regtest.12cash.dev. 3600 IN TXT "bitcoin:?lno=lno123...xyz"
;; Query time: 159 msec
;; SERVER: 2600:1700:424a:7000::1#53(2600:1700:424a:7000::1)
;; WHEN: Tue Jul 16 09:05:14 EDT 2024
;; MSG SIZE rcvd: 117
Need to investigate existing duplicates
Figured it out 😅 The duplicate check is comparing the against the value of the TXT record. If you submit with the same name, but change any data in the bip353 URI it will successfully post.
Found 2 examples of duplicate DNS records in zonefile. Investigate if the duplicate name checking is functioning properly. Investigate if there is any way for duplicate values to be created. This could also just be leftover junk from early testing.